1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-14 04:34:48 +00:00

fix(c-api): Fix the limits for size on 32bit platforms

This commit is contained in:
GrayJack 2024-04-16 16:40:42 -03:00
parent c5af2a9313
commit 8d3574066b

View File

@ -143,19 +143,6 @@ extern "C" {
#define JANET_LITTLE_ENDIAN 1 #define JANET_LITTLE_ENDIAN 1
#endif #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 */ /* Check emscripten */
#ifdef __EMSCRIPTEN__ #ifdef __EMSCRIPTEN__
#define JANET_NO_DYNAMIC_MODULES #define JANET_NO_DYNAMIC_MODULES
@ -379,6 +366,19 @@ typedef struct JanetOSRWLock JanetOSRWLock;
#include <stddef.h> #include <stddef.h>
#include <stdio.h> #include <stdio.h>
/* 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 */ /* signed size */
#ifdef _SSIZE_T #ifdef _SSIZE_T
typedef ssize_t ssize_t; typedef ssize_t ssize_t;