From aa89fd3b3e4522fe9199049a4fcc6bdc69f4bfde Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 11 Apr 2016 22:41:26 -0700 Subject: eval: ability to eval more things --- src/bignum.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/bignum.cpp') diff --git a/src/bignum.cpp b/src/bignum.cpp index 55c10e248e..7046ff4874 100644 --- a/src/bignum.cpp +++ b/src/bignum.cpp @@ -71,6 +71,11 @@ bool bignum_fits_in_bits(BigNum *bn, int bit_count, bool is_signed) { } } +void bignum_truncate(BigNum *bn, int bit_count) { + assert(bn->kind == BigNumKindInt); + bn->data.x_uint &= (1LL << bit_count) - 1; +} + uint64_t bignum_to_twos_complement(BigNum *bn) { assert(bn->kind == BigNumKindInt); -- cgit v1.2.3