Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Functions | Variables
jri_md.h File Reference
#include <assert.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  jlong

Defines

#define JRI_PUBLIC_API(ResultType)   ResultType
#define JRI_PUBLIC_VAR(VarType)   VarType
#define JRI_NATIVE_STUB(ResultType)   ResultType
#define JRI_CALLBACK
#define FAR
#define JRI_BIT(n)   ((juint)1 << (n))
#define JRI_BITMASK(n)   (JRI_BIT(n) - 1)
#define jlong_IS_ZERO(a)   (((a).hi == 0) && ((a).lo == 0))
#define jlong_EQ(a, b)   (((a).hi == (b).hi) && ((a).lo == (b).lo))
#define jlong_NE(a, b)   (((a).hi != (b).hi) || ((a).lo != (b).lo))
#define jlong_GE_ZERO(a)   (((a).hi >> 31) == 0)
#define jlong_CMP(a, op, b)
#define jlong_UCMP(a, op, b)
#define jlong_AND(r, a, b)
#define jlong_OR(r, a, b)
#define jlong_XOR(r, a, b)
#define jlong_OR2(r, a)
#define jlong_NOT(r, a)
#define jlong_NEG(r, a)
#define jlong_ADD(r, a, b)
#define jlong_SUB(r, a, b)
#define jlong_MUL(r, a, b)
#define _jlong_lo16(a)   ((a) & JRI_BITMASK(16))
#define _jlong_hi16(a)   ((a) >> 16)
#define jlong_MUL32(r, a, b)
#define jlong_UDIVMOD(qp, rp, a, b)   jlong_udivmod(qp, rp, a, b)
#define jlong_DIV(r, a, b)
#define jlong_MOD(r, a, b)
#define jlong_SHL(r, a, b)
#define jlong_ISHL(r, a, b)
#define jlong_SHR(r, a, b)
#define jlong_USHR(r, a, b)
#define jlong_L2I(i, l)   ((i) = (l).lo)
#define jlong_L2UI(ui, l)   ((ui) = (l).lo)
#define jlong_L2F(f, l)   { double _d; jlong_L2D(_d, l); (f) = (float) _d; }
#define jlong_L2D(d, l)
#define jlong_I2L(l, i)   ((l).hi = (i) >> 31, (l).lo = (i))
#define jlong_UI2L(l, ui)   ((l).hi = 0, (l).lo = (ui))
#define jlong_F2L(l, f)   { double _d = (double) f; jlong_D2L(l, _d); }
#define jlong_D2L(l, d)
#define JRI_GET_INT64(_t, _addr)   (*(jlong*)(_addr))
#define JRI_SET_INT64(_t, _addr, _v)   (*(jlong*)(_addr) = (_v))
#define JRI_GET_DOUBLE(_t, _addr)   (*(jdouble*)(_addr))
#define JRI_SET_DOUBLE(_t, _addr, _v)   (*(jdouble*)(_addr) = (_v))

Typedefs

typedef unsigned char jbool
typedef signed char jbyte
typedef unsigned long juint
typedef long jint
typedef jlong julong

Functions

 JRI_PUBLIC_API (void) jlong_udivmod(julong *qp

Variables

jlong jlong_MAXINT
jlong jlong_MININT
jlong jlong_ZERO
julongrp
julong julong a
julong julong julong b

Class Documentation

struct jlong

Definition at line 235 of file jri_md.h.

Class Members
juint hi
juint lo

Define Documentation

#define _jlong_hi16 (   a)    ((a) >> 16)

Definition at line 300 of file jri_md.h.

#define _jlong_lo16 (   a)    ((a) & JRI_BITMASK(16))

Definition at line 299 of file jri_md.h.

Definition at line 139 of file jri_md.h.

#define jlong_ADD (   r,
  a,
  b 
)
Value:
{                                              \
    jlong _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 272 of file jri_md.h.

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

Definition at line 259 of file jri_md.h.

#define jlong_CMP (   a,
  op,
  b 
)
Value:
(((int32)(a).hi op (int32)(b).hi) ||          \
                             (((a).hi == (b).hi) && ((a).lo op (b).lo)))

Definition at line 254 of file jri_md.h.

#define jlong_D2L (   l,
  d 
)
Value:
{                                                 \
    int _negative;                                                        \
    double _absval, _d_hi;                                                \
    jlong _lo_d;                                                          \
                                                                          \
    _negative = ((d) < 0);                                                \
    _absval = _negative ? -(d) : (d);                                     \
                                                                          \
    (l).hi = (juint)(_absval / 4.294967296e9);                            \
    (l).lo = 0;                                                           \
    jlong_L2D(_d_hi, l);                                                  \
    _absval -= _d_hi;                                                     \
    _lo_d.hi = 0;                                                         \
    if (_absval < 0) {                                                    \
       _lo_d.lo = (juint) -_absval;                                          \
       jlong_SUB(l, l, _lo_d);                                               \
    } else {                                                              \
       _lo_d.lo = (juint) _absval;                                           \
       jlong_ADD(l, l, _lo_d);                                               \
    }                                                                     \
                                                                          \
    if (_negative)                                                        \
       jlong_NEG(l, l);                                                      \
}

Definition at line 461 of file jri_md.h.

#define jlong_DIV (   r,
  a,
  b 
)
Value:
{                                              \
    jlong _a, _b;                                                         \
    juint _negative = (int32)(a).hi < 0;                                  \
    if (_negative) {                                                      \
       jlong_NEG(_a, a);                                                     \
    } else {                                                              \
       _a = a;                                                               \
    }                                                                     \
    if ((int32)(b).hi < 0) {                                              \
       _negative ^= 1;                                                       \
       jlong_NEG(_b, b);                                                     \
    } else {                                                              \
       _b = b;                                                               \
    }                                                                     \
    jlong_UDIVMOD(&(r), 0, _a, _b);                                       \
    if (_negative)                                                        \
       jlong_NEG(r, r);                                                      \
}

Definition at line 331 of file jri_md.h.

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

Definition at line 247 of file jri_md.h.

#define jlong_F2L (   l,
  f 
)    { double _d = (double) f; jlong_D2L(l, _d); }

Definition at line 459 of file jri_md.h.

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

Definition at line 249 of file jri_md.h.

#define jlong_I2L (   l,
  i 
)    ((l).hi = (i) >> 31, (l).lo = (i))

Definition at line 457 of file jri_md.h.

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

Definition at line 246 of file jri_md.h.

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

Definition at line 388 of file jri_md.h.

#define jlong_L2D (   d,
  l 
)
Value:
{                                                 \
    int32 _negative;                                                      \
    jlong _absval;                                                        \
                                                                          \
    _negative = (l).hi >> 31;                                             \
    if (_negative) {                                                      \
       jlong_NEG(_absval, l);                                                \
    } else {                                                              \
       _absval = l;                                                          \
    }                                                                     \
    (d) = (double)_absval.hi * 4.294967296e9 + _absval.lo;                \
    if (_negative)                                                        \
       (d) = -(d);                                                           \
}

Definition at line 442 of file jri_md.h.

#define jlong_L2F (   f,
  l 
)    { double _d; jlong_L2D(_d, l); (f) = (float) _d; }

Definition at line 440 of file jri_md.h.

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

Definition at line 438 of file jri_md.h.

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

Definition at line 439 of file jri_md.h.

#define jlong_MOD (   r,
  a,
  b 
)
Value:
{                                              \
    jlong _a, _b;                                                         \
    juint _negative = (int32)(a).hi < 0;                                  \
    if (_negative) {                                                      \
       jlong_NEG(_a, a);                                                     \
    } else {                                                              \
       _a = a;                                                               \
    }                                                                     \
    if ((int32)(b).hi < 0) {                                              \
       jlong_NEG(_b, b);                                                     \
    } else {                                                              \
       _b = b;                                                               \
    }                                                                     \
    jlong_UDIVMOD(0, &(r), _a, _b);                                       \
    if (_negative)                                                        \
       jlong_NEG(r, r);                                                      \
}

Definition at line 350 of file jri_md.h.

#define jlong_MUL (   r,
  a,
  b 
)
Value:
{                                              \
    jlong _a, _b;                                                         \
    _a = a; _b = b;                                                       \
    jlong_MUL32(r, _a.lo, _b.lo);                                         \
    (r).hi += _a.hi * _b.lo + _a.lo * _b.hi;                              \
}

Definition at line 291 of file jri_md.h.

#define jlong_MUL32 (   r,
  a,
  b 
)
Value:
{                                            \
     juint _a1, _a0, _b1, _b0, _y0, _y1, _y2, _y3;                        \
     _a1 = _jlong_hi16(a), _a0 = _jlong_lo16(a);                          \
     _b1 = _jlong_hi16(b), _b0 = _jlong_lo16(b);                          \
     _y0 = _a0 * _b0;                                                     \
     _y1 = _a0 * _b1;                                                     \
     _y2 = _a1 * _b0;                                                     \
     _y3 = _a1 * _b1;                                                     \
     _y1 += _jlong_hi16(_y0);                   /* can't carry */         \
     _y1 += _y2;                                /* might carry */         \
     if (_y1 < _y2) _y3 += 1 << 16;             /* propagate */           \
     (r).lo = (_jlong_lo16(_y1) << 16) + _jlong_lo16(_y0);                \
     (r).hi = _y3 + _jlong_hi16(_y1);                                     \
}

Definition at line 306 of file jri_md.h.

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

Definition at line 248 of file jri_md.h.

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

Definition at line 270 of file jri_md.h.

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

Definition at line 267 of file jri_md.h.

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

Definition at line 261 of file jri_md.h.

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

Definition at line 265 of file jri_md.h.

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

Definition at line 371 of file jri_md.h.

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

Definition at line 406 of file jri_md.h.

#define jlong_SUB (   r,
  a,
  b 
)
Value:
{                                              \
    jlong _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 279 of file jri_md.h.

#define jlong_UCMP (   a,
  op,
  b 
)
Value:
(((a).hi op (b).hi) ||                    \
                             (((a).hi == (b).hi) && ((a).lo op (b).lo)))

Definition at line 256 of file jri_md.h.

#define jlong_UDIVMOD (   qp,
  rp,
  a,
  b 
)    jlong_udivmod(qp, rp, a, b)

Definition at line 326 of file jri_md.h.

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

Definition at line 458 of file jri_md.h.

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

Definition at line 422 of file jri_md.h.

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

Definition at line 263 of file jri_md.h.

#define JRI_BIT (   n)    ((juint)1 << (n))

Definition at line 171 of file jri_md.h.

#define JRI_BITMASK (   n)    (JRI_BIT(n) - 1)

Definition at line 172 of file jri_md.h.

Definition at line 135 of file jri_md.h.

#define JRI_GET_DOUBLE (   _t,
  _addr 
)    (*(jdouble*)(_addr))

Definition at line 511 of file jri_md.h.

#define JRI_GET_INT64 (   _t,
  _addr 
)    (*(jlong*)(_addr))

Definition at line 498 of file jri_md.h.

#define JRI_NATIVE_STUB (   ResultType)    ResultType

Definition at line 134 of file jri_md.h.

#define JRI_PUBLIC_API (   ResultType)    ResultType

Definition at line 132 of file jri_md.h.

#define JRI_PUBLIC_VAR (   VarType)    VarType

Definition at line 133 of file jri_md.h.

#define JRI_SET_DOUBLE (   _t,
  _addr,
  _v 
)    (*(jdouble*)(_addr) = (_v))

Definition at line 512 of file jri_md.h.

#define JRI_SET_INT64 (   _t,
  _addr,
  _v 
)    (*(jlong*)(_addr) = (_v))

Definition at line 499 of file jri_md.h.


Typedef Documentation

typedef unsigned char jbool

Definition at line 154 of file jri_md.h.

typedef signed char jbyte

Definition at line 155 of file jri_md.h.

typedef long jint

Definition at line 161 of file jri_md.h.

typedef unsigned long juint

Definition at line 160 of file jri_md.h.

typedef jlong julong

Definition at line 242 of file jri_md.h.


Function Documentation


Variable Documentation

Definition at line 329 of file jri_md.h.

Definition at line 329 of file jri_md.h.

void * rp

Definition at line 329 of file jri_md.h.