2020-08-18 16:25:12 +02:00
|
|
|
From 7c32c58f4ce802d2682038f73bb8c8f850237f89 Mon Sep 17 00:00:00 2001
|
2020-04-27 07:46:49 +02:00
|
|
|
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
|
|
|
Date: Sun, 26 Apr 2020 15:33:39 +0200
|
2020-04-30 21:44:21 +02:00
|
|
|
Subject: [PATCH] Use LONG_BIT to define RADIX_BITS
|
2020-04-27 07:46:49 +02:00
|
|
|
|
|
|
|
This allows to avoid having to support each CPU architecture
|
|
|
|
individually.
|
|
|
|
|
2020-08-18 16:25:12 +02:00
|
|
|
Also, add the necessary defines in the makefile to expose LONG_BIT
|
|
|
|
|
2020-04-27 07:46:49 +02:00
|
|
|
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
2020-04-30 21:44:21 +02:00
|
|
|
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
|
2020-04-27 07:46:49 +02:00
|
|
|
---
|
|
|
|
src/LibSupport.h | 17 +++--------------
|
2020-08-18 16:25:12 +02:00
|
|
|
src/makefile | 2 ++
|
|
|
|
2 files changed, 5 insertions(+), 14 deletions(-)
|
2020-04-27 07:46:49 +02:00
|
|
|
|
|
|
|
diff --git a/src/LibSupport.h b/src/LibSupport.h
|
2020-08-18 16:25:12 +02:00
|
|
|
index b2e6a51..0b59d18 100644
|
2020-04-27 07:46:49 +02:00
|
|
|
--- a/src/LibSupport.h
|
|
|
|
+++ b/src/LibSupport.h
|
|
|
|
@@ -64,20 +64,9 @@
|
|
|
|
#ifndef _LIB_SUPPORT_H_
|
|
|
|
#define _LIB_SUPPORT_H_
|
|
|
|
|
|
|
|
-#ifndef RADIX_BITS
|
|
|
|
-# if defined(__x86_64__) || defined(__x86_64) \
|
|
|
|
- || defined(__amd64__) || defined(__amd64) || defined(_WIN64) || defined(_M_X64) \
|
|
|
|
- || defined(_M_ARM64) || defined(__aarch64__) \
|
|
|
|
- || defined(__powerpc64__) || defined(__ppc64__)
|
|
|
|
-# define RADIX_BITS 64
|
|
|
|
-# elif defined(__i386__) || defined(__i386) || defined(i386) \
|
|
|
|
- || defined(_WIN32) || defined(_M_IX86) \
|
|
|
|
- || defined(_M_ARM) || defined(__arm__) || defined(__thumb__)
|
|
|
|
-# define RADIX_BITS 32
|
|
|
|
-# else
|
|
|
|
-# error Unable to determine RADIX_BITS from compiler environment
|
|
|
|
-# endif
|
|
|
|
-#endif // RADIX_BITS
|
|
|
|
+#include <limits.h>
|
|
|
|
+
|
2020-04-30 21:44:21 +02:00
|
|
|
+#define RADIX_BITS LONG_BIT
|
2020-04-27 07:46:49 +02:00
|
|
|
|
|
|
|
// These macros use the selected libraries to the proper include files.
|
|
|
|
#define LIB_QUOTE(_STRING_) #_STRING_
|
2020-08-18 16:25:12 +02:00
|
|
|
diff --git a/src/makefile b/src/makefile
|
|
|
|
index f124e78..9af1e51 100644
|
|
|
|
--- a/src/makefile
|
|
|
|
+++ b/src/makefile
|
|
|
|
@@ -46,6 +46,8 @@ CCFLAGS = -Wall \
|
|
|
|
-c -ggdb -O0 \
|
|
|
|
-DTPM_POSIX \
|
|
|
|
-D_POSIX_ \
|
|
|
|
+ -D_DEFAULT_SOURCE \
|
|
|
|
+ -D_XOPEN_SOURCE \
|
|
|
|
-DTPM_NUVOTON
|
|
|
|
|
|
|
|
# add this line for big endian platforms
|
2020-04-27 07:46:49 +02:00
|
|
|
--
|
2020-08-18 16:25:12 +02:00
|
|
|
2.28.0
|
2020-04-27 07:46:49 +02:00
|
|
|
|