diff options
Diffstat (limited to 'gl/u64.h')
-rw-r--r-- | gl/u64.h | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -30,6 +30,7 @@ typedef uint64_t u64; # define u64hilo(hi, lo) ((u64) (((u64) (hi) << 32) + (lo))) # define u64init(hi, lo) u64hilo (hi, lo) # define u64lo(x) ((u64) (x)) +# define u64size(x) u64lo (x) # define u64lt(x, y) ((x) < (y)) # define u64and(x, y) ((x) & (y)) # define u64or(x, y) ((x) | (y)) @@ -72,6 +73,16 @@ u64lo (uint32_t lo) return r; } +/* Return a u64 value representing SIZE. */ +static inline u64 +u64size (size_t size) +{ + u64 r; + r.hi = size >> 31 >> 1; + r.lo = size; + return r; +} + /* Return X < Y. */ static inline int u64lt (u64 x, u64 y) |