diff --git a/litex/soc/software/include/base/stddef.h b/litex/soc/software/include/base/stddef.h index 4f9a211f7..858d70b3e 100644 --- a/litex/soc/software/include/base/stddef.h +++ b/litex/soc/software/include/base/stddef.h @@ -11,8 +11,13 @@ extern "C" { #define NULL ((void *)0) #endif +#ifdef __LP64__ typedef unsigned long size_t; typedef long ptrdiff_t; +#else +typedef unsigned int size_t; +typedef int ptrdiff_t; +#endif #define offsetof(type, member) __builtin_offsetof(type, member) diff --git a/litex/soc/software/include/base/stdint.h b/litex/soc/software/include/base/stdint.h index bff5d0983..a17e1739a 100644 --- a/litex/soc/software/include/base/stdint.h +++ b/litex/soc/software/include/base/stdint.h @@ -5,8 +5,13 @@ extern "C" { #endif +#ifdef __LP64__ +typedef long intptr_t; +typedef unsigned long uintptr_t; +#else typedef int intptr_t; typedef unsigned int uintptr_t; +#endif typedef unsigned long long uint64_t; typedef unsigned int uint32_t;