57 #ifdef JS_HAVE_LONG_LONG 59 #define JSLL_INIT(hi, lo) ((UINT64_C(hi) << 32) + UINT64_C(lo)) 78 #define JSLL_IS_ZERO(a) ((a) == 0) 79 #define JSLL_EQ(a, b) ((a) == (b)) 80 #define JSLL_NE(a, b) ((a) != (b)) 81 #define JSLL_GE_ZERO(a) ((a) >= 0) 82 #define JSLL_CMP(a, op, b) ((JSInt64)(a) op (JSInt64)(b)) 83 #define JSLL_UCMP(a, op, b) ((JSUint64)(a) op (JSUint64)(b)) 94 #define JSLL_AND(r, a, b) ((r) = (a) & (b)) 95 #define JSLL_OR(r, a, b) ((r) = (a) | (b)) 96 #define JSLL_XOR(r, a, b) ((r) = (a) ^ (b)) 97 #define JSLL_OR2(r, a) ((r) = (r) | (a)) 98 #define JSLL_NOT(r, a) ((r) = ~(a)) 107 #define JSLL_NEG(r, a) ((r) = -(a)) 108 #define JSLL_ADD(r, a, b) ((r) = (a) + (b)) 109 #define JSLL_SUB(r, a, b) ((r) = (a) - (b)) 119 #define JSLL_MUL(r, a, b) ((r) = (a) * (b)) 120 #define JSLL_MUL32(r, a, b) ((r) = (JSUint64)(a) * (JSUint32)(b)) 121 #define JSLL_DIV(r, a, b) ((r) = (a) / (b)) 122 #define JSLL_MOD(r, a, b) ((r) = (a) % (b)) 133 #define JSLL_SHL(r, a, b) ((r) = (JSInt64)(a) << (b)) 134 #define JSLL_SHR(r, a, b) ((r) = (JSInt64)(a) >> (b)) 135 #define JSLL_USHR(r, a, b) ((r) = (JSUint64)(a) >> (b)) 136 #define JSLL_ISHL(r, a, b) ((r) = (JSInt64)(a) << (b)) 150 #define JSLL_L2I(i, l) ((i) = (JSInt32)(l)) 151 #define JSLL_L2UI(ui, l) ((ui) = (JSUint32)(l)) 152 #define JSLL_L2F(f, l) ((f) = (JSFloat64)(l)) 153 #define JSLL_L2D(d, l) ((d) = (JSFloat64)(l)) 155 #define JSLL_I2L(l, i) ((l) = (JSInt64)(i)) 156 #define JSLL_UI2L(l, ui) ((l) = (JSInt64)(ui)) 157 #define JSLL_F2L(l, f) ((l) = (JSInt64)(f)) 158 #define JSLL_D2L(l, d) ((l) = (JSInt64)(d)) 169 #define JSLL_UDIVMOD(qp, rp, a, b) \ 170 (*(qp) = ((JSUint64)(a) / (b)), \ 171 *(rp) = ((JSUint64)(a) % (b))) 184 #define JSLL_HEXSTR(s, a) sprintf( s, "%016" PRIx64, a) 185 #define JSLL_DECSTR(s, a) sprintf( s, "%" PRId64, a) 186 #define JSLL_UDECSTR(s, a) sprintf( s, "%" PRIu64, a) 190 #ifdef IS_LITTLE_ENDIAN 191 #define JSLL_INIT(hi, lo) { lo, hi } 193 #define JSLL_INIT(hi, lo) { hi, lo } 196 #define JSLL_IS_ZERO(a) (((a).hi == 0) && ((a).lo == 0)) 197 #define JSLL_EQ(a, b) (((a).hi == (b).hi) && ((a).lo == (b).lo)) 198 #define JSLL_NE(a, b) (((a).hi != (b).hi) || ((a).lo != (b).lo)) 199 #define JSLL_GE_ZERO(a) (((a).hi >> 31) == 0) 202 #define JSLL_CMP(a, op, b) (JS_ASSERT((#op)[1] != '='), JSLL_REAL_CMP(a, op, b)) 203 #define JSLL_UCMP(a, op, b) (JS_ASSERT((#op)[1] != '='), JSLL_REAL_UCMP(a, op, b)) 205 #define JSLL_CMP(a, op, b) JSLL_REAL_CMP(a, op, b) 206 #define JSLL_UCMP(a, op, b) JSLL_REAL_UCMP(a, op, b) 209 #define JSLL_REAL_CMP(a,op,b) (((JSInt32)(a).hi op (JSInt32)(b).hi) || \ 210 (((a).hi == (b).hi) && ((a).lo op (b).lo))) 211 #define JSLL_REAL_UCMP(a,op,b) (((a).hi op (b).hi) || \ 212 (((a).hi == (b).hi) && ((a).lo op (b).lo))) 214 #define JSLL_AND(r, a, b) ((r).lo = (a).lo & (b).lo, \ 215 (r).hi = (a).hi & (b).hi) 216 #define JSLL_OR(r, a, b) ((r).lo = (a).lo | (b).lo, \ 217 (r).hi = (a).hi | (b).hi) 218 #define JSLL_XOR(r, a, b) ((r).lo = (a).lo ^ (b).lo, \ 219 (r).hi = (a).hi ^ (b).hi) 220 #define JSLL_OR2(r, a) ((r).lo = (r).lo | (a).lo, \ 221 (r).hi = (r).hi | (a).hi) 222 #define JSLL_NOT(r, a) ((r).lo = ~(a).lo, \ 225 #define JSLL_NEG(r, a) ((r).lo = -(JSInt32)(a).lo, \ 226 (r).hi = -(JSInt32)(a).hi - ((r).lo != 0)) 227 #define JSLL_ADD(r, a, b) { \ 229 t = (a).lo + (b).lo; \ 230 (r).hi = (a).hi + (b).hi + (t < (b).lo); \ 234 #define JSLL_SUB(r, a, b) { \ 235 (r).hi = (a).hi - (b).hi - ((a).lo < (b).lo); \ 236 (r).lo = (a).lo - (b).lo; \ 239 #define JSLL_MUL(r, a, b) jsll_mul( &(r), a, b) 242 #define JSLL_MUL32(r, a, b) jsll_mul32( &(r), a, b) 243 void jsll_mul32(
JSUint64 *rp, JSUint32 a, JSUint32 b);
245 #define JSLL_UDIVMOD(qp, rp, a, b) jsll_udivmod(qp, rp, a, b) 248 #define JSLL_DIV(r, a, b) jsll_div( &(r), &(a), &(b)) 251 #define JSLL_MOD(r, a, b) jsll_mod( &(r), &(a), &(b)) 255 #define JSLL_ISHL(r, a, b) { \ 258 (r).lo = (a) << ((b) & 31); \ 259 (r).hi = ((a) >> (32 - (b))); \ 262 (r).hi = (a) << ((b) & 31); \ 270 #define JSLL_SHL(r, a, b) jsll_shl( &(r), a, b) 271 #define JSLL_SHR(r, a, b) jsll_shr( &(r), a, b) 272 #define JSLL_USHR(r, a, b) jsll_ushr( &(r), a, b) 278 #define JSLL_L2I(i, l) ((i) = (l).lo) 279 #define JSLL_L2UI(ui, l) ((ui) = (l).lo) 280 #define JSLL_L2F(f, l) { double _d; JSLL_L2D(_d, l); (f) = (JSFloat64)_d; } 282 #define JSLL_L2D(d, l) { \ 286 _negative = (JSInt32)(l).hi < 0; \ 288 JSLL_NEG(_absval, l); \ 292 (d) = (double)_absval.hi * 4.294967296e9 + _absval.lo; \ 297 #define JSLL_I2L(l, i) {(l).lo = (i); (l).hi = (JSInt32)(i) >> 31; } 298 #define JSLL_UI2L(l, ui) ((l).lo = (ui), (l).hi = 0) 299 #define JSLL_F2L(l, f) { double _d = (double)f; JSLL_D2L(l, _d); } 301 #define JSLL_D2L(l, d) { \ 303 double _absval, _d_hi; \ 306 _negative = ((d) < 0); \ 307 _absval = _negative ? -(d) : (d); \ 309 (l).hi = _absval / 4.294967296e9; \ 311 JSLL_L2D(_d_hi, l); \ 315 _lo_d.lo = -_absval; \ 316 JSLL_SUB(l, l, _lo_d); \ 318 _lo_d.lo = _absval; \ 319 JSLL_ADD(l, l, _lo_d); \ 326 #define JSLL_HEXSTR(s, a) \ 327 sprintf( s, "%08" PRIx32 "%08" PRIx32, (a).hi, (a).lo) 328 #define JSLL_DECSTR(s, a) jsll_decstr( s, &(a)) 329 #define JSLL_UDECSTR(s, a) jsll_udecstr( s, &(a)) 331 int jsll_decstr(
char *buffer,
const JSInt64 *v);
332 int jsll_udecstr(
char *buffer,
const JSUint64 *v);
Definition: jslong_glue.h:30