diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2013-04-26 22:13:24 +1000 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2013-04-26 22:13:24 +1000 |
| commit | 1fc8a2f2a45c21247f6d0209ecb6349a2c20e453 (patch) | |
| tree | b6cbbc746df84c17175172e30ef810155ab1e92d /src | |
| parent | 106fd12423491625b78326a2d2055d7e1d43464f (diff) | |
| download | rust-1fc8a2f2a45c21247f6d0209ecb6349a2c20e453.tar.gz rust-1fc8a2f2a45c21247f6d0209ecb6349a2c20e453.zip | |
rt: use the [u]int[nn]_t types in the RNG.
This means that `ub4`s are always 4 bytes, rather than being 8 bytes on x64. (Suggested but not implemented by upstream: "Porting it to a 64-bit machine [...] may just need an adjustment of the definition of ub4")
Diffstat (limited to 'src')
| -rw-r--r-- | src/rt/isaac/standard.h | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/rt/isaac/standard.h b/src/rt/isaac/standard.h index cb6cc15b8f6..c196a37474b 100644 --- a/src/rt/isaac/standard.h +++ b/src/rt/isaac/standard.h @@ -13,27 +13,32 @@ Standard definitions and types, Bob Jenkins # include <stddef.h> # define STDDEF # endif -typedef unsigned long long ub8; +# ifndef STDINT +# include <stdint.h> +# define STDINT +# endif + +typedef uint64_t ub8; #define UB8MAXVAL 0xffffffffffffffffLL #define UB8BITS 64 -typedef signed long long sb8; +typedef int64_t sb8; #define SB8MAXVAL 0x7fffffffffffffffLL -typedef unsigned long int ub4; /* unsigned 4-byte quantities */ +typedef uint32_t ub4; /* unsigned 4-byte quantities */ #define UB4MAXVAL 0xffffffff -typedef signed long int sb4; +typedef int32_t sb4; #define UB4BITS 32 #define SB4MAXVAL 0x7fffffff -typedef unsigned short int ub2; +typedef uint16_t ub2; #define UB2MAXVAL 0xffff #define UB2BITS 16 -typedef signed short int sb2; +typedef int16_t sb2; #define SB2MAXVAL 0x7fff -typedef unsigned char ub1; +typedef uint8_t ub1; #define UB1MAXVAL 0xff #define UB1BITS 8 -typedef signed char sb1; /* signed 1-byte quantities */ +typedef int8_t sb1; /* signed 1-byte quantities */ #define SB1MAXVAL 0x7f -typedef int word; /* fastest type available */ +typedef int word; /* fastest type available */ #define bis(target,mask) ((target) |= (mask)) #define bic(target,mask) ((target) &= ~(mask)) |
