Merge pull request #1450 from dykeag/patch-1
More reliable determination of architecture size
This commit is contained in:
@@ -17,19 +17,25 @@ extern "C" {
|
|||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
*********************/
|
*********************/
|
||||||
// Check windows
|
|
||||||
#ifdef _WIN64
|
#if __STDC_VERSION__ >= 199901L // If c99 or newer, use stdint.h to determine arch size
|
||||||
#define LV_ARCH_64
|
#include <stdint.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Check GCC */
|
|
||||||
#ifdef __GNUC__
|
// If __UINTPTR_MAX__ or UINTPTR_MAX are available, use them to determine arch size
|
||||||
#if defined(__x86_64__) || defined(__ppc64__)
|
#if defined(__UINTPTR_MAX__) && __UINTPTR_MAX__ > 0xFFFFFFFF
|
||||||
#define LV_ARCH_64
|
#define LV_ARCH_64
|
||||||
#endif
|
|
||||||
|
#elif defined(UINTPTR_MAX) && UINTPTR_MAX > 0xFFFFFFFF
|
||||||
|
#define LV_ARCH_64
|
||||||
|
|
||||||
|
// Otherwise use compiler-dependent means to determine arch size
|
||||||
|
#elif defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) || defined (__aarch64__)
|
||||||
|
#define LV_ARCH_64
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LV_UNUNSED(x) (void)x;
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
@@ -45,12 +51,24 @@ enum {
|
|||||||
};
|
};
|
||||||
typedef uint8_t lv_res_t;
|
typedef uint8_t lv_res_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if __STDC_VERSION__ >= 199901L
|
||||||
|
// If c99 or newer, use the definition of uintptr_t directly from <stdint.h>
|
||||||
|
typedef uintptr_t lv_uintptr_t;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
// Otherwise, use the arch size determination
|
||||||
#ifdef LV_ARCH_64
|
#ifdef LV_ARCH_64
|
||||||
typedef uint64_t lv_uintptr_t;
|
typedef uint64_t lv_uintptr_t;
|
||||||
#else
|
#else
|
||||||
typedef uint32_t lv_uintptr_t;
|
typedef uint32_t lv_uintptr_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* GLOBAL PROTOTYPES
|
* GLOBAL PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
@@ -64,3 +82,4 @@ typedef uint32_t lv_uintptr_t;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /*LV_TYPES_H*/
|
#endif /*LV_TYPES_H*/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user