Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
prlong.h File Reference
#include "prtypes.h"

Go to the source code of this file.

Defines

#define LL_MAXINT   LL_MaxInt()
#define LL_MININT   LL_MinInt()
#define LL_ZERO   LL_Zero()
#define LL_MAXUINT   LL_MaxUint()
#define LL_INIT(hi, lo)   {PR_UINT32(hi), PR_UINT32(lo)}
#define LL_IS_ZERO(a)   (((a).hi == 0) && ((a).lo == 0))
#define LL_EQ(a, b)   (((a).hi == (b).hi) && ((a).lo == (b).lo))
#define LL_NE(a, b)   (((a).hi != (b).hi) || ((a).lo != (b).lo))
#define LL_GE_ZERO(a)   (((a).hi >> 31) == 0)
#define LL_CMP(a, op, b)
#define LL_UCMP(a, op, b)
#define LL_AND(r, a, b)
#define LL_OR(r, a, b)
#define LL_XOR(r, a, b)
#define LL_OR2(r, a)
#define LL_NOT(r, a)
#define LL_NEG(r, a)
#define LL_ADD(r, a, b)
#define LL_SUB(r, a, b)
#define LL_MUL(r, a, b)
#define _lo16(a)   ((a) & PR_BITMASK(16))
#define _hi16(a)   ((a) >> 16)
#define LL_MUL32(r, a, b)
#define LL_UDIVMOD(qp, rp, a, b)   ll_udivmod(qp, rp, a, b)
#define LL_DIV(r, a, b)
#define LL_MOD(r, a, b)
#define LL_SHL(r, a, b)
#define LL_ISHL(r, a, b)
#define LL_SHR(r, a, b)
#define LL_USHR(r, a, b)
#define LL_L2I(i, l)   ((i) = (l).lo)
#define LL_L2UI(ui, l)   ((ui) = (l).lo)
#define LL_L2F(f, l)   { double _d; LL_L2D(_d, l); (f) = (PRFloat64)_d; }
#define LL_L2D(d, l)
#define LL_I2L(l, i)   { PRInt32 _i = ((PRInt32)(i)) >> 31; (l).lo = (i); (l).hi = _i; }
#define LL_UI2L(l, ui)   ((l).lo = (ui), (l).hi = 0)
#define LL_F2L(l, f)   { double _d = (double)f; LL_D2L(l, _d); }
#define LL_D2L(l, d)

Functions

PR_BEGIN_EXTERN_C NSPR_API (PRInt64) LL_MaxInt(void)
 NSPR_API (void) ll_udivmod(PRUint64 *qp
 Prototypes for machine dependent function implementations.

Variables

PRUint64rp
PRUint64 PRUint64 a
PRUint64 PRUint64 PRUint64 b

Define Documentation

#define _hi16 (   a)    ((a) >> 16)

Definition at line 267 of file prlong.h.

#define _lo16 (   a)    ((a) & PR_BITMASK(16))

Definition at line 266 of file prlong.h.

#define LL_ADD (   r,
  a,
  b 
)
Value:
{ \
    PRInt64 _a, _b; \
    _a = a; _b = b; \
    (r).lo = _a.lo + _b.lo; \
    (r).hi = _a.hi + _b.hi + ((r).lo < _b.lo); \
}

Definition at line 245 of file prlong.h.

#define LL_AND (   r,
  a,
  b 
)
Value:
((r).lo = (a).lo & (b).lo, \
                 (r).hi = (a).hi & (b).hi)

Definition at line 232 of file prlong.h.

#define LL_CMP (   a,
  op,
  b 
)
Value:
(((a).hi == (b).hi) ? ((a).lo op (b).lo) : \
                 ((PRInt32)(a).hi op (PRInt32)(b).hi))

Definition at line 227 of file prlong.h.

#define LL_D2L (   l,
  d 
)
Value:
{ \
    int _negative; \
    double _absval, _d_hi; \
    PRInt64 _lo_d; \
 \
    _negative = ((d) < 0); \
    _absval = _negative ? -(d) : (d); \
 \
    (l).hi = _absval / 4.294967296e9; \
    (l).lo = 0; \
    LL_L2D(_d_hi, l); \
    _absval -= _d_hi; \
    _lo_d.hi = 0; \
    if (_absval < 0) { \
    _lo_d.lo = -_absval; \
    LL_SUB(l, l, _lo_d); \
    } else { \
    _lo_d.lo = _absval; \
    LL_ADD(l, l, _lo_d); \
    } \
 \
    if (_negative) \
    LL_NEG(l, l); \
}

Definition at line 416 of file prlong.h.

#define LL_DIV (   r,
  a,
  b 
)
Value:
{ \
    PRInt64 _a, _b; \
    PRUint32 _negative = (PRInt32)(a).hi < 0; \
    if (_negative) { \
    LL_NEG(_a, a); \
    } else { \
    _a = a; \
    } \
    if ((PRInt32)(b).hi < 0) { \
    _negative ^= 1; \
    LL_NEG(_b, b); \
    } else { \
    _b = b; \
    } \
    LL_UDIVMOD(&(r), 0, _a, _b); \
    if (_negative) \
    LL_NEG(r, r); \
}

Definition at line 289 of file prlong.h.

#define LL_EQ (   a,
  b 
)    (((a).hi == (b).hi) && ((a).lo == (b).lo))

Definition at line 223 of file prlong.h.

#define LL_F2L (   l,
  f 
)    { double _d = (double)f; LL_D2L(l, _d); }

Definition at line 414 of file prlong.h.

#define LL_GE_ZERO (   a)    (((a).hi >> 31) == 0)

Definition at line 225 of file prlong.h.

#define LL_I2L (   l,
  i 
)    { PRInt32 _i = ((PRInt32)(i)) >> 31; (l).lo = (i); (l).hi = _i; }

Definition at line 412 of file prlong.h.

#define LL_INIT (   hi,
  lo 
)    {PR_UINT32(hi), PR_UINT32(lo)}

Definition at line 219 of file prlong.h.

#define LL_IS_ZERO (   a)    (((a).hi == 0) && ((a).lo == 0))

Definition at line 222 of file prlong.h.

#define LL_ISHL (   r,
  a,
  b 
)
Value:
{ \
    if (b) { \
    PRInt64 _a; \
    _a.lo = (a); \
    _a.hi = 0; \
        if ((b) < 32) { \
        (r).lo = (a) << ((b) & 31); \
        (r).hi = ((a) >> (32 - (b))); \
    } else { \
        (r).lo = 0; \
        (r).hi = (a) << ((b) & 31); \
    } \
    } else { \
    (r).lo = (a); \
    (r).hi = 0; \
    } \
}

Definition at line 343 of file prlong.h.

#define LL_L2D (   d,
  l 
)
Value:
{ \
    int _negative; \
    PRInt64 _absval; \
 \
    _negative = (l).hi >> 31; \
    if (_negative) { \
    LL_NEG(_absval, l); \
    } else { \
    _absval = l; \
    } \
    (d) = (double)_absval.hi * 4.294967296e9 + _absval.lo; \
    if (_negative) \
    (d) = -(d); \
}

Definition at line 397 of file prlong.h.

#define LL_L2F (   f,
  l 
)    { double _d; LL_L2D(_d, l); (f) = (PRFloat64)_d; }

Definition at line 395 of file prlong.h.

#define LL_L2I (   i,
  l 
)    ((i) = (l).lo)

Definition at line 393 of file prlong.h.

#define LL_L2UI (   ui,
  l 
)    ((ui) = (l).lo)

Definition at line 394 of file prlong.h.

#define LL_MAXINT   LL_MaxInt()

Definition at line 211 of file prlong.h.

#define LL_MAXUINT   LL_MaxUint()

Definition at line 214 of file prlong.h.

#define LL_MININT   LL_MinInt()

Definition at line 212 of file prlong.h.

#define LL_MOD (   r,
  a,
  b 
)
Value:
{ \
    PRInt64 _a, _b; \
    PRUint32 _negative = (PRInt32)(a).hi < 0; \
    if (_negative) { \
    LL_NEG(_a, a); \
    } else { \
    _a = a; \
    } \
    if ((PRInt32)(b).hi < 0) { \
    LL_NEG(_b, b); \
    } else { \
    _b = b; \
    } \
    LL_UDIVMOD(0, &(r), _a, _b); \
    if (_negative) \
    LL_NEG(r, r); \
}

Definition at line 308 of file prlong.h.

#define LL_MUL (   r,
  a,
  b 
)
Value:
{ \
    PRInt64 _a, _b; \
    _a = a; _b = b; \
    LL_MUL32(r, _a.lo, _b.lo); \
    (r).hi += _a.hi * _b.lo + _a.lo * _b.hi; \
}

Definition at line 259 of file prlong.h.

#define LL_MUL32 (   r,
  a,
  b 
)
Value:
{ \
     PRUint32 _a1, _a0, _b1, _b0, _y0, _y1, _y2, _y3; \
     _a1 = _hi16(a), _a0 = _lo16(a); \
     _b1 = _hi16(b), _b0 = _lo16(b); \
     _y0 = _a0 * _b0; \
     _y1 = _a0 * _b1; \
     _y2 = _a1 * _b0; \
     _y3 = _a1 * _b1; \
     _y1 += _hi16(_y0);                         /* can't carry */ \
     _y1 += _y2;                                /* might carry */ \
     if (_y1 < _y2)    \
        _y3 += (PRUint32)(PR_BIT(16));  /* propagate */ \
     (r).lo = (_lo16(_y1) << 16) + _lo16(_y0); \
     (r).hi = _y3 + _hi16(_y1); \
}

Definition at line 269 of file prlong.h.

#define LL_NE (   a,
  b 
)    (((a).hi != (b).hi) || ((a).lo != (b).lo))

Definition at line 224 of file prlong.h.

#define LL_NEG (   r,
  a 
)
Value:
((r).lo = -(PRInt32)(a).lo, \
                 (r).hi = -(PRInt32)(a).hi - ((r).lo != 0))

Definition at line 243 of file prlong.h.

#define LL_NOT (   r,
  a 
)
Value:
((r).lo = ~(a).lo, \
                 (r).hi = ~(a).hi)

Definition at line 240 of file prlong.h.

#define LL_OR (   r,
  a,
  b 
)
Value:
((r).lo = (a).lo | (b).lo, \
                 (r).hi = (a).hi | (b).hi)

Definition at line 234 of file prlong.h.

#define LL_OR2 (   r,
  a 
)
Value:
((r).lo = (r).lo | (a).lo, \
                 (r).hi = (r).hi | (a).hi)

Definition at line 238 of file prlong.h.

#define LL_SHL (   r,
  a,
  b 
)
Value:
{ \
    if (b) { \
    PRInt64 _a; \
        _a = a; \
        if ((b) < 32) { \
        (r).lo = _a.lo << ((b) & 31); \
        (r).hi = (_a.hi << ((b) & 31)) | (_a.lo >> (32 - (b))); \
    } else { \
        (r).lo = 0; \
        (r).hi = _a.lo << ((b) & 31); \
    } \
    } else { \
    (r) = (a); \
    } \
}

Definition at line 326 of file prlong.h.

#define LL_SHR (   r,
  a,
  b 
)
Value:
{ \
    if (b) { \
    PRInt64 _a; \
        _a = a; \
    if ((b) < 32) { \
        (r).lo = (_a.hi << (32 - (b))) | (_a.lo >> ((b) & 31)); \
        (r).hi = (PRInt32)_a.hi >> ((b) & 31); \
    } else { \
        (r).lo = (PRInt32)_a.hi >> ((b) & 31); \
        (r).hi = (PRInt32)_a.hi >> 31; \
    } \
    } else { \
    (r) = (a); \
    } \
}

Definition at line 361 of file prlong.h.

#define LL_SUB (   r,
  a,
  b 
)
Value:
{ \
    PRInt64 _a, _b; \
    _a = a; _b = b; \
    (r).lo = _a.lo - _b.lo; \
    (r).hi = _a.hi - _b.hi - (_a.lo < _b.lo); \
}

Definition at line 252 of file prlong.h.

#define LL_UCMP (   a,
  op,
  b 
)
Value:
(((a).hi == (b).hi) ? ((a).lo op (b).lo) : \
                 ((a).hi op (b).hi))

Definition at line 229 of file prlong.h.

#define LL_UDIVMOD (   qp,
  rp,
  a,
  b 
)    ll_udivmod(qp, rp, a, b)

Definition at line 285 of file prlong.h.

#define LL_UI2L (   l,
  ui 
)    ((l).lo = (ui), (l).hi = 0)

Definition at line 413 of file prlong.h.

#define LL_USHR (   r,
  a,
  b 
)
Value:
{ \
    if (b) { \
    PRInt64 _a; \
        _a = a; \
    if ((b) < 32) { \
        (r).lo = (_a.hi << (32 - (b))) | (_a.lo >> ((b) & 31)); \
        (r).hi = _a.hi >> ((b) & 31); \
    } else { \
        (r).lo = _a.hi >> ((b) & 31); \
        (r).hi = 0; \
    } \
    } else { \
    (r) = (a); \
    } \
}

Definition at line 377 of file prlong.h.

#define LL_XOR (   r,
  a,
  b 
)
Value:
((r).lo = (a).lo ^ (b).lo, \
                 (r).hi = (a).hi ^ (b).hi)

Definition at line 236 of file prlong.h.

#define LL_ZERO   LL_Zero()

Definition at line 213 of file prlong.h.


Function Documentation

NSPR_API ( void  )

Prototypes for machine dependent function implementations.

(Too bad NSPR's MD system blows so much that we have to reiterate every stinking thing we implement here in our MD header file.)


Variable Documentation

Definition at line 287 of file prlong.h.

Definition at line 287 of file prlong.h.

Definition at line 287 of file prlong.h.