Skip to content

Commit

Permalink
don't try to use 128-bit types on 32-bit platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
dstndstn committed Jan 17, 2022
1 parent 973fbb0 commit 968113c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion libkd/kdint_ttype_l.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,27 @@

typedef u64 ttype;

// https://stackoverflow.com/questions/16088282/is-there-a-128-bit-integer-in-gcc
// gcc: 128-bit ints only available on 64-bit platforms, not 32-bit
#ifdef __SIZEOF_INT128__
// GCC only??
typedef __int128 int128_t;
typedef unsigned __int128 uint128_t;
static const uint128_t UINT128_MAX = (uint128_t)((int128_t)(-1L));

#define BIGTTYPE uint128_t
#define BIGTTYPE_MAX UINT128_MAX
typedef uint128_t bigttype;

#else
// Fall back to using just 64-bit types. This *should* still work okay, because
// we're careful to check the max possible value before using BIGT types; search
// for "use_tmath" in the code.
#define BIGTTYPE uint64_t
#define BIGTTYPE_MAX UINT64_MAX
typedef uint64_t bigttype;

#endif

#define TTYPE_INTEGER 1

#define TTYPE_MIN 0
Expand Down

0 comments on commit 968113c

Please sign in to comment.