aboutsummaryrefslogtreecommitdiffstats
path: root/main/drbd-utils/bits_per_long.patch
blob: f6b580eedbcb549a08cbf1be1d167935a4168520 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
diff --git a/user/shared/drbd_endian.h b/user/shared/drbd_endian.h
index 69f7145..515c942 100644
--- a/user/shared/drbd_endian.h
+++ b/user/shared/drbd_endian.h
@@ -13,12 +13,17 @@
 
 #include <stdint.h>
 #include <endian.h>
+#include <limits.h>
 
 #ifndef BITS_PER_LONG
 # if defined(__SIZEOF_LONG__)
 #  define BITS_PER_LONG (__SIZEOF_LONG__ * 8)
 # elif defined(__WORDSIZE)
 #  define BITS_PER_LONG __WORDSIZE
+# elif ULONG_MAX == 0xffffffffffffffff
+#  define BITS_PER_LONG 64
+# elif ULONG_MAX == 0xffffffff
+#  define BITS_PER_LONG 32
 # else /* wtf is wrong with your libc headers? */
 #  error "neither BITS_PER_LONG, __SIZEOF_LONG__, nor __WORDSIZE defined"
 # endif