Skip to content

Commit

Permalink
Get rid of unnecessary __MINGW32__, fix limb
Browse files Browse the repository at this point in the history
  • Loading branch information
satk0 committed Oct 6, 2024
1 parent 29d1cad commit e1baab2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
6 changes: 3 additions & 3 deletions cutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <stdarg.h>
#include <string.h>
#include <time.h>
#if !defined(_MSC_VER) || !__MINGW32__
#if !defined(_MSC_VER)
#include <sys/time.h>
#endif

Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 1 addition & 3 deletions libbf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion quickjs-libc.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#endif
#include <errno.h>
#include <fcntl.h>
#if !defined(_MSC_VER) || !__MINGW32__
#if !defined(_MSC_VER)
#include <sys/time.h>
#endif
#include <time.h>
Expand Down
2 changes: 1 addition & 1 deletion quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <inttypes.h>
#include <string.h>
#include <assert.h>
#if !defined(_MSC_VER) || !__MINGW32__
#if !defined(_MSC_VER)
#include <sys/time.h>
#if defined(_WIN32)
#include <timezoneapi.h>
Expand Down

0 comments on commit e1baab2

Please sign in to comment.