Skip to content

Commit 1fc8a2f

Browse files
committed
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")
1 parent 106fd12 commit 1fc8a2f

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/rt/isaac/standard.h

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,32 @@ Standard definitions and types, Bob Jenkins
1313
# include <stddef.h>
1414
# define STDDEF
1515
# endif
16-
typedef unsigned long long ub8;
16+
# ifndef STDINT
17+
# include <stdint.h>
18+
# define STDINT
19+
# endif
20+
21+
typedef uint64_t ub8;
1722
#define UB8MAXVAL 0xffffffffffffffffLL
1823
#define UB8BITS 64
19-
typedef signed long long sb8;
24+
typedef int64_t sb8;
2025
#define SB8MAXVAL 0x7fffffffffffffffLL
21-
typedef unsigned long int ub4; /* unsigned 4-byte quantities */
26+
typedef uint32_t ub4; /* unsigned 4-byte quantities */
2227
#define UB4MAXVAL 0xffffffff
23-
typedef signed long int sb4;
28+
typedef int32_t sb4;
2429
#define UB4BITS 32
2530
#define SB4MAXVAL 0x7fffffff
26-
typedef unsigned short int ub2;
31+
typedef uint16_t ub2;
2732
#define UB2MAXVAL 0xffff
2833
#define UB2BITS 16
29-
typedef signed short int sb2;
34+
typedef int16_t sb2;
3035
#define SB2MAXVAL 0x7fff
31-
typedef unsigned char ub1;
36+
typedef uint8_t ub1;
3237
#define UB1MAXVAL 0xff
3338
#define UB1BITS 8
34-
typedef signed char sb1; /* signed 1-byte quantities */
39+
typedef int8_t sb1; /* signed 1-byte quantities */
3540
#define SB1MAXVAL 0x7f
36-
typedef int word; /* fastest type available */
41+
typedef int word; /* fastest type available */
3742

3843
#define bis(target,mask) ((target) |= (mask))
3944
#define bic(target,mask) ((target) &= ~(mask))

0 commit comments

Comments
 (0)