summaryrefslogtreecommitdiff
path: root/lib/u64.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2012-08-01 21:46:10 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2012-08-01 21:46:10 -0700
commita0d4efe9c3c01fde58b401ee5ab88f052128fa85 (patch)
tree70862330c792d4ba0d16d9b389e742d65ddf2004 /lib/u64.h
parent13294f95172c68a5e77143f917231e0f17f37537 (diff)
downloademacs-a0d4efe9c3c01fde58b401ee5ab88f052128fa85.tar.gz
Merge from gnulib, for extern-inline.
2012-08-01 extern-inline: new module 2012-08-01 stat-time, timespec, u64, utimens: use extern-inline * lib/stat-time.c, lib/utimespec.c, lib/u64.c, m4/extern-inline.m4: New files. The new .c files are for instantiating extern inline functions. Fixes: debbugs:12116
Diffstat (limited to 'lib/u64.h')
-rw-r--r--lib/u64.h27
1 files changed, 17 insertions, 10 deletions
diff --git a/lib/u64.h b/lib/u64.h
index f5ec9ebcb3d..6a7d370c12b 100644
--- a/lib/u64.h
+++ b/lib/u64.h
@@ -19,6 +19,11 @@
#include <stdint.h>
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_U64_INLINE
+# define _GL_U64_INLINE _GL_INLINE
+#endif
+
/* Return X rotated left by N bits, where 0 < N < 64. */
#define u64rol(x, n) u64or (u64shl (x, n), u64shr (x, 64 - n))
@@ -54,7 +59,7 @@ typedef struct { uint32_t lo, hi; } u64;
/* Given the high and low-order 32-bit quantities HI and LO, return a u64
value representing (HI << 32) + LO. */
-static inline u64
+_GL_U64_INLINE u64
u64hilo (uint32_t hi, uint32_t lo)
{
u64 r;
@@ -64,7 +69,7 @@ u64hilo (uint32_t hi, uint32_t lo)
}
/* Return a u64 value representing LO. */
-static inline u64
+_GL_U64_INLINE u64
u64lo (uint32_t lo)
{
u64 r;
@@ -74,7 +79,7 @@ u64lo (uint32_t lo)
}
/* Return a u64 value representing SIZE. */
-static inline u64
+_GL_U64_INLINE u64
u64size (size_t size)
{
u64 r;
@@ -84,14 +89,14 @@ u64size (size_t size)
}
/* Return X < Y. */
-static inline int
+_GL_U64_INLINE int
u64lt (u64 x, u64 y)
{
return x.hi < y.hi || (x.hi == y.hi && x.lo < y.lo);
}
/* Return X & Y. */
-static inline u64
+_GL_U64_INLINE u64
u64and (u64 x, u64 y)
{
u64 r;
@@ -101,7 +106,7 @@ u64and (u64 x, u64 y)
}
/* Return X | Y. */
-static inline u64
+_GL_U64_INLINE u64
u64or (u64 x, u64 y)
{
u64 r;
@@ -111,7 +116,7 @@ u64or (u64 x, u64 y)
}
/* Return X ^ Y. */
-static inline u64
+_GL_U64_INLINE u64
u64xor (u64 x, u64 y)
{
u64 r;
@@ -121,7 +126,7 @@ u64xor (u64 x, u64 y)
}
/* Return X + Y. */
-static inline u64
+_GL_U64_INLINE u64
u64plus (u64 x, u64 y)
{
u64 r;
@@ -131,7 +136,7 @@ u64plus (u64 x, u64 y)
}
/* Return X << N. */
-static inline u64
+_GL_U64_INLINE u64
u64shl (u64 x, int n)
{
u64 r;
@@ -149,7 +154,7 @@ u64shl (u64 x, int n)
}
/* Return X >> N. */
-static inline u64
+_GL_U64_INLINE u64
u64shr (u64 x, int n)
{
u64 r;
@@ -167,3 +172,5 @@ u64shr (u64 x, int n)
}
#endif
+
+_GL_INLINE_HEADER_END