From c2aa5e9486b88f24703b833a55c85e525acb50df Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 9 Nov 2025 13:53:57 -0500 Subject: Cut out a level of pointer indirection for integers by using underlying struct --- src/stdlib/bigint.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/stdlib/bigint.h') diff --git a/src/stdlib/bigint.h b/src/stdlib/bigint.h index 558bc099..614e1501 100644 --- a/src/stdlib/bigint.h +++ b/src/stdlib/bigint.h @@ -34,13 +34,14 @@ bool Int$get_bit(Int_t x, Int_t bit_index); #define SMALLEST_SMALL_INT -0x40000000 #define Int$from_mpz(mpz) \ - (mpz_cmpabs_ui(mpz, BIGGEST_SMALL_INT) <= 0 ? ((Int_t){.small = (mpz_get_si(mpz) << 2L) | 1L}) \ - : ((Int_t){.big = memcpy(new (mpz_t), &mpz, sizeof(mpz_t))})) + (mpz_cmpabs_ui(mpz, BIGGEST_SMALL_INT) <= 0 \ + ? ((Int_t){.small = (mpz_get_si(mpz) << 2L) | 1L}) \ + : ((Int_t){.big = memcpy(new (__mpz_struct), mpz, sizeof(__mpz_struct))})) #define mpz_init_set_int(mpz, i) \ do { \ if likely ((i).small & 1L) mpz_init_set_si(mpz, (i).small >> 2L); \ - else mpz_init_set(mpz, *(i).big); \ + else mpz_init_set(mpz, (i).big); \ } while (0) #define I_small(i) ((Int_t){.small = (int64_t)((uint64_t)(i) << 2L) | 1L}) -- cgit v1.2.3