Working on casts

This commit is contained in:
Krzosa Karol
2022-06-06 13:24:01 +02:00
parent 4f876a36a4
commit 06d6ec7525
8 changed files with 145 additions and 100 deletions

View File

@@ -3,8 +3,9 @@
// a copy of which can be found in the LICENSE file.
struct Token;
global S64 bigint_allocation_count;
function void parsing_error(Token *token, const char *str, ...);
#define malloc_arena(x) exp_alloc(&pernament_arena, x)
#define malloc_arena(x) (bigint_allocation_count++, exp_alloc(&pernament_arena, x))
#define ALLOC_DIGITS(_digits) (uint64_t *)((_digits) ? malloc_arena(sizeof(uint64_t) * (_digits)) : NULL)
#define FATAL_ERROR(x) parsing_error(0, x)
@@ -18,7 +19,6 @@ struct BigInt
};
};
#include <inttypes.h>
enum CmpRes
{
@@ -74,14 +74,14 @@ size_t bigint_popcount_unsigned(const BigInt *big_int);
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
static BigInt
function BigInt
bigint_u64(U64 value){
BigInt result;
bigint_init_unsigned(&result, value);
return result;
}
static BigInt
function BigInt
bigint_s64(S64 value){
BigInt result;
bigint_init_signed(&result, value);