diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-04-14 10:40:08 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-04-14 10:40:08 -0700 |
| commit | 579856e502eab87ea8a73a76dc63a2108e5a8cc8 (patch) | |
| tree | feb34b0985b29f45073ac81e21982a368e0a3542 /src/bignum.cpp | |
| parent | 5a479720ec5786145dac6c85deae4e322bd5972e (diff) | |
| parent | fcedc35551cc6b14756499414e47c33004de3be4 (diff) | |
| download | zig-579856e502eab87ea8a73a76dc63a2108e5a8cc8.tar.gz zig-579856e502eab87ea8a73a76dc63a2108e5a8cc8.zip | |
Merge branch 'eval'
Diffstat (limited to 'src/bignum.cpp')
| -rw-r--r-- | src/bignum.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
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); |
