From 8d3574066bbd0d2a0fcc7dfb4ada8be985be392b Mon Sep 17 00:00:00 2001 From: GrayJack Date: Tue, 16 Apr 2024 16:40:42 -0300 Subject: [PATCH] fix(c-api): Fix the limits for size on 32bit platforms --- src/include/janet.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/include/janet.h b/src/include/janet.h index 71ec9518..32554ab2 100644 --- a/src/include/janet.h +++ b/src/include/janet.h @@ -143,19 +143,6 @@ extern "C" { #define JANET_LITTLE_ENDIAN 1 #endif -/* Limits for converting doubles to 64 bit integers */ -#define JANET_INTMAX_DOUBLE 9007199254740992.0 -#define JANET_INTMIN_DOUBLE (-9007199254740992.0) -#define JANET_INTMAX_INT64 9007199254740992 -#define JANET_INTMIN_INT64 (-9007199254740992) -#if defined(JANET_64) - #define JANET_INTMAX_SIZE JANET_INTMAX_INT64 - #define JANET_INTMIN_SIZE JANET_INTMIN_INT64 -#else - #define JANET_INTMAX_SIZE 4294967295 - #define JANET_INTMIN_SIZE (-4294967295) -#endif - /* Check emscripten */ #ifdef __EMSCRIPTEN__ #define JANET_NO_DYNAMIC_MODULES @@ -379,6 +366,19 @@ typedef struct JanetOSRWLock JanetOSRWLock; #include #include +/* Limits for converting doubles to 64 bit integers */ +#define JANET_INTMAX_DOUBLE 9007199254740992.0 +#define JANET_INTMIN_DOUBLE (-9007199254740992.0) +#define JANET_INTMAX_INT64 9007199254740992 +#define JANET_INTMIN_INT64 (-9007199254740992) +#if defined(JANET_64) + #define JANET_INTMAX_SIZE JANET_INTMAX_INT64 + #define JANET_INTMIN_SIZE JANET_INTMIN_INT64 +#else + #define JANET_INTMAX_SIZE INT32_MAX + #define JANET_INTMIN_SIZE INT32_MIN +#endif + /* signed size */ #ifdef _SSIZE_T typedef ssize_t ssize_t;