masks

Discussion in 'C Programming' started by Uno, Aug 17, 2010.

  1. Uno

    Uno Guest

    This is excerpted from Plauger:

    /* values used by <float.h> macros -- IEEE 754 version */
    #include <float.h>

    /* macros */
    #define DFRAC (49+_DOFF)
    #define DMAXE ((1U<<(15-_DOFF))-1)
    #define FFRAC (17+_FOFF)
    #define FMAXE ((1U<<(15-_FOFF))-1)
    #define LFRAC (49+_LOFF)
    #define LMAXE 0x7fff
    #define LOG2 0.30103
    #if _D0 != 0 /* low to high words */
    #define DINIT(w0, wx) wx, wx, wx, w0
    #define FINIT(w0, wx) wx, w0
    #define LINIT(w0, w1, wx) wx, wx, wx, w1, w0
    #else /* high to low words */
    #define DINIT(w0, wx) w0, wx, wx, wx
    #define FINIT(w0, wx) w0, wx
    #define LINIT(w0, w1, wx) w0, w1, wx, wx, wx
    #endif
    /* static data */
    _Dvals _Dbl = {
    (int)((DFRAC-1)*LOG2), /* DBL_DIG */
    (int)DFRAC, /* DBL_MANT_DIG */
    (int)((DMAXE-_DBIAS-1)*LOG2), /* DBL_MAX_10_EXP */
    (int)(DMAXE-_DBIAS-1), /* DBL_MAX_EXP */
    (int)(-_DBIAS*LOG2), /* DBL_MIN_10_EXP */
    (int)(1-_DBIAS), /* DBL_MIN_EXP */
    {DINIT(_DBIAS-DFRAC+2<<_DOFF, 0)}, /* DBL_EPSILON */
    {DINIT((DMAXE<<_DOFF)-1, ~0)}, /* DBL_MAX */
    {DINIT(1<<_DOFF, 0)}, /* DBL_MIN */
    };
    _Dvals _Flt = {
    (int)((FFRAC-1)*LOG2), /* FLT_DIG */
    (int)FFRAC, /* FLT_MANT_DIG */
    (int)((FMAXE-_FBIAS-1)*LOG2), /* FLT_MAX_10_EXP */
    (int)(FMAXE-_FBIAS-1), /* FLT_MAX_EXP */
    (int)(-_FBIAS*LOG2), /* FLT_MIN_10_EXP */
    (int)(1-_FBIAS), /* FLT_MIN_EXP */
    {FINIT(_FBIAS-FFRAC+2<<_FOFF, 0)}, /* FLT_EPSILON */
    {FINIT((FMAXE<<_FOFF)-1, ~0)}, /* FLT_MAX */
    {FINIT(1<<_FOFF, 0)}, /* FLT_MIN */
    };
    #if _DLONG
    _Dvals _Ldbl = {
    (int)((LFRAC-1)*LOG2), /* LDBL_DIG */
    (int)LFRAC, /* LDBL_MANT_DIG */
    (int)((LMAXE-_LBIAS-1)*LOG2), /* LDBL_MAX_10_EXP */
    (int)(LMAXE-_LBIAS-1), /* LDBL_MAX_EXP */
    (int)(-_LBIAS*LOG2), /* LDBL_MIN_10_EXP */
    (int)(1-_LBIAS), /* LDBL_MIN_EXP */
    {LINIT(_LBIAS-LFRAC+2, 0x8000, 0)}, /* LDBL_EPSILON */
    {LINIT(LMAXE-1, ~0, ~0)}, /* LDBL_MAX */
    {LINIT(1, 0x8000, 0)}, /* LDBL_MIN */
    };
    #else
    _Dvals _Ldbl = {
    (int)(DFRAC*LOG2), /* LDBL_DIG */
    (int)DFRAC, /* LDBL_MANT_DIG */
    (int)((DMAXE-_DBIAS-1)*LOG2), /* LDBL_MAX_10_EXP */
    (int)(DMAXE-_DBIAS-1), /* LDBL_MAX_EXP */
    (int)(-_DBIAS*LOG2), /* LDBL_MIN_10_EXP */
    (int)(1-_DBIAS), /* LDBL_MIN_EXP */
    {DINIT(_DBIAS-DFRAC+2<<_DOFF, 0)}, /* LDBL_EPSILON */
    {DINIT((DMAXE<<_DOFF)-1, ~0)}, /* LDBL_MAX */
    {DINIT(1<<_DOFF, 0)}, /* LDBL_MIN */
    };
    #endif

    I can't read through the masks here.
    --
    Uno
     
    Uno, Aug 17, 2010
    #1
    1. Advertising

  2. On 17 Aug, 06:07, Uno <> wrote:

    > This is excerpted from Plauger:
    >
    > /* values used by <float.h> macros -- IEEE 754 version */
    > #include <float.h>
    >
    >                 /* macros */
    > #define DFRAC   (49+_DOFF)
    > #define DMAXE   ((1U<<(15-_DOFF))-1)
    > #define FFRAC   (17+_FOFF)
    > #define FMAXE   ((1U<<(15-_FOFF))-1)
    > #define LFRAC   (49+_LOFF)
    > #define LMAXE   0x7fff
    > #define LOG2    0.30103
    > #if _D0 != 0    /* low to high words */
    > #define DINIT(w0, wx)   wx, wx, wx, w0
    > #define FINIT(w0, wx)   wx, w0
    > #define LINIT(w0, w1, wx)       wx, wx, wx, w1, w0
    > #else   /* high to low words */
    > #define DINIT(w0, wx)   w0, wx, wx, wx
    > #define FINIT(w0, wx)   w0, wx
    > #define LINIT(w0, w1, wx)       w0, w1, wx, wx, wx
    > #endif
    >                 /* static data */
    > _Dvals _Dbl = {
    >         (int)((DFRAC-1)*LOG2),          /* DBL_DIG */
    >         (int)DFRAC,                             /* DBL_MANT_DIG */
    >         (int)((DMAXE-_DBIAS-1)*LOG2),   /* DBL_MAX_10_EXP */
    >         (int)(DMAXE-_DBIAS-1),          /* DBL_MAX_EXP */
    >         (int)(-_DBIAS*LOG2),    /* DBL_MIN_10_EXP */
    >         (int)(1-_DBIAS),                /* DBL_MIN_EXP */
    >         {DINIT(_DBIAS-DFRAC+2<<_DOFF, 0)},        /* DBL_EPSILON */
    >         {DINIT((DMAXE<<_DOFF)-1, ~0)},    /* DBL_MAX */
    >         {DINIT(1<<_DOFF, 0)},             /* DBL_MIN */
    >         };


    <snip>

    >
    > I can't read through the masks here.


    what?
     
    Nick Keighley, Aug 17, 2010
    #2
    1. Advertising

  3. Uno

    Nick Guest

    Uno <> writes:

    > I can't read through the masks here.


    You've got them on upside down and the eyeholes aren't lining up.
    --
    Online waterways route planner | http://canalplan.eu
    Plan trips, see photos, check facilities | http://canalplan.org.uk
     
    Nick, Aug 17, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gianni Mariani
    Replies:
    0
    Views:
    335
    Gianni Mariani
    Jan 13, 2005
  2. lezard

    masks

    lezard, Jun 1, 2005, in forum: C Programming
    Replies:
    4
    Views:
    598
    Michael Wojcik
    Jun 2, 2005
  3. bobrics
    Replies:
    2
    Views:
    726
    Flash Gordon
    Mar 21, 2006
  4. Dave

    shifts and masks

    Dave, Jun 3, 2006, in forum: C Programming
    Replies:
    4
    Views:
    454
    Malcolm
    Jun 4, 2006
  5. Dave

    replace bitfields with shifts and masks

    Dave, Jun 4, 2006, in forum: C Programming
    Replies:
    3
    Views:
    320
    Chris Torek
    Jun 4, 2006
Loading...

Share This Page