eval: ability to eval more things

This commit is contained in:
Andrew Kelley
2016-04-11 22:41:26 -07:00
parent fa605485ea
commit aa89fd3b3e
7 changed files with 337 additions and 114 deletions

View File

@@ -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);