Testing big ints
This commit is contained in:
@@ -9,11 +9,13 @@ function void parsing_error(Token *token, const char *str, ...);
|
||||
|
||||
#define Set_BigInt_Allocator(x) BigInt_Allocator bigint_allocator(x)
|
||||
struct BigInt_Allocator{
|
||||
BigInt_Allocator(Allocator *allocator){bigint_allocator = allocator;}
|
||||
~BigInt_Allocator(){bigint_allocator = 0;}
|
||||
Allocator *old;
|
||||
BigInt_Allocator(Allocator *allocator){old = bigint_allocator; bigint_allocator = allocator;}
|
||||
~BigInt_Allocator(){bigint_allocator = old;}
|
||||
};
|
||||
|
||||
#define malloc_arena(x) (bigint_allocation_count++, exp_alloc(bigint_allocator, x, AF_ZeroMemory))
|
||||
#define count_bigint_alloc() (bigint_allocator != thread_ctx.scratch ? bigint_allocation_count++ : 0)
|
||||
#define malloc_arena(x) (count_bigint_alloc(), exp_alloc(bigint_allocator, x, AF_ZeroMemory))
|
||||
#define ALLOC_DIGITS(_digits) (uint64_t *)((_digits) ? malloc_arena(sizeof(uint64_t) * (_digits)) : NULL)
|
||||
#define FATAL_ERROR(x) parsing_error(0, x)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user