Bug 708735 - Use <stdint.h> types in JSAPI and throughout SpiderMonkey. Continue to provide the {u,}int{8,16,32,64} and JS{Uint,Int}{8,16,32,64} integer types through a single header, however, for a simpler backout strategy -- and also to ease the transition for embedders. r=timeless on switching the jsd API to use the <stdint.h> types, r=luke, r=dmandelin

This commit is contained in:
Jeff Walden
2011-12-08 22:54:10 -05:00
parent 2975363755
commit 12e010ddeb
258 changed files with 3769 additions and 3834 deletions

View File

@@ -61,20 +61,20 @@ using namespace js;
#endif
#ifndef Long
#define Long int32
#define Long int32_t
#endif
#ifndef ULong
#define ULong uint32
#define ULong uint32_t
#endif
/*
#ifndef Llong
#define Llong JSInt64
#define Llong int64_t
#endif
#ifndef ULlong
#define ULlong JSUint64
#define ULlong uint64_t
#endif
*/
@@ -91,7 +91,7 @@ inline void dtoa_free(void* p) { return UnwantedForeground::free_(p); }
#include "dtoa.c"
/* Mapping of JSDToStrMode -> js_dtoa mode */
static const uint8 dtoaModes[] = {
static const uint8_t dtoaModes[] = {
0, /* DTOSTR_STANDARD */
0, /* DTOSTR_STANDARD_EXPONENTIAL, */
3, /* DTOSTR_FIXED, */
@@ -246,11 +246,11 @@ js_dtostr(DtoaState *state, char *buffer, size_t bufferSize, JSDToStrMode mode,
/* Let b = floor(b / divisor), and return the remainder. b must be nonnegative.
* divisor must be between 1 and 65536.
* This function cannot run out of memory. */
static uint32
divrem(Bigint *b, uint32 divisor)
static uint32_t
divrem(Bigint *b, uint32_t divisor)
{
int32 n = b->wds;
uint32 remainder = 0;
int32_t n = b->wds;
uint32_t remainder = 0;
ULong *bx;
ULong *bp;
@@ -281,13 +281,13 @@ divrem(Bigint *b, uint32 divisor)
}
/* Return floor(b/2^k) and set b to be the remainder. The returned quotient must be less than 2^32. */
static uint32 quorem2(Bigint *b, int32 k)
static uint32_t quorem2(Bigint *b, int32_t k)
{
ULong mask;
ULong result;
ULong *bx, *bxe;
int32 w;
int32 n = k >> 5;
int32_t w;
int32_t n = k >> 5;
k &= 0x1F;
mask = (1<<k) - 1;
@@ -328,7 +328,7 @@ js_dtobasestr(DtoaState *state, int base, double dinput)
char *p; /* Pointer to current position in the buffer */
char *pInt; /* Pointer to the beginning of the integer part of the string */
char *q;
uint32 digit;
uint32_t digit;
U di; /* d truncated to an integer */
U df; /* The fractional part of d */
@@ -359,13 +359,13 @@ js_dtobasestr(DtoaState *state, int base, double dinput)
pInt = p;
dval(di) = floor(dval(d));
if (dval(di) <= 4294967295.0) {
uint32 n = (uint32)dval(di);
uint32_t n = (uint32_t)dval(di);
if (n)
do {
uint32 m = n / base;
uint32_t m = n / base;
digit = n - m*base;
n = m;
JS_ASSERT(digit < (uint32)base);
JS_ASSERT(digit < (uint32_t)base);
*p++ = BASEDIGIT(digit);
} while (n);
else *p++ = '0';
@@ -384,7 +384,7 @@ js_dtobasestr(DtoaState *state, int base, double dinput)
}
do {
digit = divrem(b, base);
JS_ASSERT(digit < (uint32)base);
JS_ASSERT(digit < (uint32_t)base);
*p++ = BASEDIGIT(digit);
} while (b->wds);
Bfree(PASS_STATE b);
@@ -401,7 +401,7 @@ js_dtobasestr(DtoaState *state, int base, double dinput)
if (dval(df) != 0.0) {
/* We have a fraction. */
int e, bbits;
int32 s2, done;
int32_t s2, done;
Bigint *b, *s, *mlo, *mhi;
b = s = mlo = mhi = NULL;
@@ -421,7 +421,7 @@ js_dtobasestr(DtoaState *state, int base, double dinput)
JS_ASSERT(e < 0);
/* At this point df = b * 2^e. e must be less than zero because 0 < df < 1. */
s2 = -(int32)(word0(d) >> Exp_shift1 & Exp_mask>>Exp_shift1);
s2 = -(int32_t)(word0(d) >> Exp_shift1 & Exp_mask>>Exp_shift1);
#ifndef Sudden_Underflow
if (!s2)
s2 = -1;
@@ -462,7 +462,7 @@ js_dtobasestr(DtoaState *state, int base, double dinput)
done = JS_FALSE;
do {
int32 j, j1;
int32_t j, j1;
Bigint *delta;
b = multadd(PASS_STATE b, base, 0);
@@ -521,7 +521,7 @@ js_dtobasestr(DtoaState *state, int base, double dinput)
digit++;
done = JS_TRUE;
}
JS_ASSERT(digit < (uint32)base);
JS_ASSERT(digit < (uint32_t)base);
*p++ = BASEDIGIT(digit);
} while (!done);
Bfree(PASS_STATE b);