mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
software/include/base: Fix size_t, ptrdiff_t, and (u)intptr_t
As per convention, the types of size_t, ptrdiff_t, intptr_t, and uintptr_t should be based on "long" or "int" depending on the platform (32-bit or 64-bit). This fixes compiler warnings of the following type: litex/soc/software/liblitesdcard/sdcard.c: In function 'sdcard_read': litex/soc/software/liblitesdcard/sdcard.c:476:39: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] sdblock2mem_dma_base_write((uint64_t)(uintptr_t) buf); ^ Reported-by: Gabriel Somlo <gsomlo@gmail.com> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
This commit is contained in:
parent
1710c5f1ef
commit
91c9192626
2 changed files with 10 additions and 0 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue