summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2015-02-11 07:10:07 (GMT)
committerAndreas Schneider <asn@cryptomilk.org>2015-02-11 16:09:11 (GMT)
commitdabc59d760226559e2ef8174ddc5fb45878bf106 (patch)
tree5a9111b07302fc4be7f74baa36b94bf4db13186d
parentf02f7357187e9b80da1dd7539333bc0c3a134987 (diff)
downloadcmocka-dabc59d760226559e2ef8174ddc5fb45878bf106.zip
cmocka-dabc59d760226559e2ef8174ddc5fb45878bf106.tar.gz
cmocka-dabc59d760226559e2ef8174ddc5fb45878bf106.tar.bz2
include: Define __WORDSIZE if needed.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--include/cmocka.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/cmocka.h b/include/cmocka.h
index d1c057b..2980055 100644
--- a/include/cmocka.h
+++ b/include/cmocka.h
@@ -60,6 +60,16 @@ int __stdcall IsDebuggerPresent();
* Largest integral type. This type should be large enough to hold any
* pointer or integer supported by the compiler.
*/
+
+/* If __WORDSIZE is not set, try to figure it out and default to 32 bit. */
+#ifndef __WORDSIZE
+# if defined(__x86_64__) && !defined(__ILP32__)
+# define __WORDSIZE 64
+# else
+# define __WORDSIZE 32
+# endif
+#endif
+
#ifndef LargestIntegralType
# if __WORDSIZE == 64
# define LargestIntegralType unsigned long int