aboutsummaryrefslogtreecommitdiff
path: root/builtins/datatypes.h
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-08-13 01:30:25 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-08-13 01:30:25 -0400
commitd08f795794b33a5d52e39c6b9f0c4e6e88fede3d (patch)
tree7267e0828b73685f9af0c3e9cf58212c45af289c /builtins/datatypes.h
parentc1c889b024529ac754f83caec4cc15971123d07b (diff)
Partially working first draft of bigints
Diffstat (limited to 'builtins/datatypes.h')
-rw-r--r--builtins/datatypes.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/builtins/datatypes.h b/builtins/datatypes.h
index a9f28dc1..699c40e0 100644
--- a/builtins/datatypes.h
+++ b/builtins/datatypes.h
@@ -2,6 +2,7 @@
// Common datastructures (arrays, tables, closures)
+#include <gmp.h>
#include <stdint.h>
#include <stdbool.h>
#include <pthread.h>
@@ -17,6 +18,11 @@
#define ARRAY_MAX_DATA_REFCOUNT MAX_FOR_N_BITS(ARRAY_REFCOUNT_BITS)
#define ARRAY_MAX_FREE_ENTRIES MAX_FOR_N_BITS(ARRAY_FREE_BITS)
+typedef union {
+ int64_t small;
+ mpz_t *big;
+} Int_t;
+
typedef struct {
void *data;
// All of the following fields add up to 64 bits, which means that array
@@ -55,7 +61,7 @@ typedef struct {
} closure_t;
typedef struct Range_s {
- int64_t first, last, step;
+ Int_t first, last, step;
} Range_t;
typedef struct {