The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/bitsy/fpi.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 typedef long Word;
    2 typedef unsigned long Single;
    3 typedef struct {
    4         unsigned long l;
    5         unsigned long h;
    6 } Double;
    7 
    8 enum {
    9         FractBits       = 28,
   10         CarryBit        = 0x10000000,
   11         HiddenBit       = 0x08000000,
   12         MsBit           = HiddenBit,
   13         NGuardBits      = 3,
   14         GuardMask       = 0x07,
   15         LsBit           = (1<<NGuardBits),
   16 
   17         SingleExpBias   = 127,
   18         SingleExpMax    = 255,
   19         DoubleExpBias   = 1023,
   20         DoubleExpMax    = 2047,
   21 
   22         ExpBias         = DoubleExpBias,
   23         ExpInfinity     = DoubleExpMax,
   24 };
   25 
   26 typedef struct {
   27         unsigned char s;
   28         short e;
   29         long l;                         /* 0000FFFFFFFFFFFFFFFFFFFFFFFFFGGG */
   30         long h;                         /* 0000HFFFFFFFFFFFFFFFFFFFFFFFFFFF */
   31 } Internal;
   32 
   33 #define IsWeird(n)      ((n)->e >= ExpInfinity)
   34 #define IsInfinity(n)   (IsWeird(n) && (n)->h == HiddenBit && (n)->l == 0)
   35 #define SetInfinity(n)  ((n)->e = ExpInfinity, (n)->h = HiddenBit, (n)->l = 0)
   36 #define IsNaN(n)        (IsWeird(n) && (((n)->h & ~HiddenBit) || (n)->l))
   37 #define SetQNaN(n)      ((n)->s = 0, (n)->e = ExpInfinity,              \
   38                          (n)->h = HiddenBit|(LsBit<<1), (n)->l = 0)
   39 #define IsZero(n)       ((n)->e == 1 && (n)->h == 0 && (n)->l == 0)
   40 #define SetZero(n)      ((n)->e = 1, (n)->h = 0, (n)->l = 0)
   41 
   42 /*
   43  * fpi.c
   44  */
   45 extern void fpiround(Internal *);
   46 extern void fpiadd(Internal *, Internal *, Internal *);
   47 extern void fpisub(Internal *, Internal *, Internal *);
   48 extern void fpimul(Internal *, Internal *, Internal *);
   49 extern void fpidiv(Internal *, Internal *, Internal *);
   50 extern int fpicmp(Internal *, Internal *);
   51 extern void fpinormalise(Internal*);
   52 
   53 /*
   54  * fpimem.c
   55  */
   56 extern void fpis2i(Internal *, void *);
   57 extern void fpid2i(Internal *, void *);
   58 extern void fpiw2i(Internal *, void *);
   59 extern void fpii2s(void *, Internal *);
   60 extern void fpii2d(void *, Internal *);
   61 extern void fpii2w(Word *, Internal *);

Cache object: 2da4a0a7cb7a0002a24267de53b26a57


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.