From e0786c3f94996bef0dc291131f14f3590c867976 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Tue, 19 Jan 2021 14:28:24 +0100 Subject: [PATCH] software/include/base: Check __LP64__ instead of __WORDSIZE __WORDSIZE is defined by glibc, not by the compiler. Hence it is never defined for us, and checking __WORDSIZE to determine the size of "long" thus causes subtle misbehavings. Fix this by checking for the presence of __LP64__ instead. Signed-off-by: Geert Uytterhoeven --- litex/soc/software/include/base/inttypes.h | 2 +- litex/soc/software/include/base/lfsr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/litex/soc/software/include/base/inttypes.h b/litex/soc/software/include/base/inttypes.h index 4afd04b62..bc22376a6 100644 --- a/litex/soc/software/include/base/inttypes.h +++ b/litex/soc/software/include/base/inttypes.h @@ -24,7 +24,7 @@ #include -# if __WORDSIZE == 64 +# ifdef __LP64__ # define __PRI64_PREFIX "l" # define __PRIPTR_PREFIX "l" # else diff --git a/litex/soc/software/include/base/lfsr.h b/litex/soc/software/include/base/lfsr.h index 50dfccfc7..8326b811a 100644 --- a/litex/soc/software/include/base/lfsr.h +++ b/litex/soc/software/include/base/lfsr.h @@ -65,7 +65,7 @@ static inline unsigned long lfsr(unsigned long bits, unsigned long prev) 0x20000029, 0x48000000, 0x80200003, -#if __WORDSIZE == 64 +#ifdef __LP64__ 0x100080000, 0x204000003, 0x500000000,