summaryrefslogtreecommitdiff
path: root/gl/u64.h
diff options
context:
space:
mode:
Diffstat (limited to 'gl/u64.h')
-rw-r--r--gl/u64.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/gl/u64.h b/gl/u64.h
index dadd6d741f..f5ec9ebcb3 100644
--- a/gl/u64.h
+++ b/gl/u64.h
@@ -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)