From e1baab2171bfd3a0198dd7ce09918fa8d5043655 Mon Sep 17 00:00:00 2001 From: satk0 Date: Sun, 6 Oct 2024 21:38:38 +0200 Subject: [PATCH] Get rid of unnecessary __MINGW32__, fix limb --- cutils.c | 6 +++--- libbf.c | 4 +--- quickjs-libc.c | 2 +- quickjs.c | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/cutils.c b/cutils.c index 435eaa18..4d114810 100644 --- a/cutils.c +++ b/cutils.c @@ -28,7 +28,7 @@ #include #include #include -#if !defined(_MSC_VER) || !__MINGW32__ +#if !defined(_MSC_VER) #include #endif @@ -1129,7 +1129,7 @@ void rqsort(void *base, size_t nmemb, size_t size, cmp_f cmp, void *opaque) /*---- Portable time functions ----*/ -#if defined(_MSC_VER) || __MINGW32__ +#if defined(_MSC_VER) // From: https://stackoverflow.com/a/26085827 static int gettimeofday_msvc(struct timeval *tp, struct timezone *tzp) { @@ -1184,7 +1184,7 @@ uint64_t js__hrtime_ns(void) { int64_t js__gettimeofday_us(void) { struct timeval tv; -#if defined(_MSC_VER) || __MINGW32__ +#if defined(_MSC_VER) gettimeofday_msvc(&tv, NULL); #else gettimeofday(&tv, NULL); diff --git a/libbf.c b/libbf.c index 640018fe..b5691aad 100644 --- a/libbf.c +++ b/libbf.c @@ -1711,11 +1711,9 @@ static int __bf_div(bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, na = n + nb; -#if !defined(_WIN32) - if (na >= (SIZE_MAX / sizeof(limb_t)) - 1) { + if (LIMB_LOG2_BITS == 6 && na >= (SIZE_MAX / sizeof(limb_t)) - 1) { return BF_ST_MEM_ERROR; /* Return memory error status */ } -#endif taba = bf_malloc(s, (na + 1) * sizeof(limb_t)); if (!taba) diff --git a/quickjs-libc.c b/quickjs-libc.c index e92b7248..b8102b72 100644 --- a/quickjs-libc.c +++ b/quickjs-libc.c @@ -33,7 +33,7 @@ #endif #include #include -#if !defined(_MSC_VER) || !__MINGW32__ +#if !defined(_MSC_VER) #include #endif #include diff --git a/quickjs.c b/quickjs.c index 8084045f..ef5bfdc1 100644 --- a/quickjs.c +++ b/quickjs.c @@ -30,7 +30,7 @@ #include #include #include -#if !defined(_MSC_VER) || !__MINGW32__ +#if !defined(_MSC_VER) #include #if defined(_WIN32) #include