bigint: make sure bigand is normalized

This commit is contained in:
Josh Stone 2017-09-19 17:53:13 -07:00
parent 952dba4e06
commit 3c1c84307c
2 changed files with 3 additions and 0 deletions

View File

@ -288,6 +288,7 @@ impl<'a> BitAndAssign<&'a BigUint> for BigUint {
*ai &= bi;
}
self.data.truncate(other.data.len());
self.normalize();
}
}

View File

@ -203,6 +203,8 @@ const BIT_TESTS: &'static [(&'static [BigDigit],
&'static [BigDigit],
&'static [BigDigit])] = &[// LEFT RIGHT AND OR XOR
(&[], &[], &[], &[], &[]),
(&[1, 0, 1], &[1, 1], &[1], &[1, 1, 1], &[0, 1, 1]),
(&[1, 0, 1], &[0, 1, 1], &[0, 0, 1], &[1, 1, 1], &[1, 1]),
(&[268, 482, 17],
&[964, 54],
&[260, 34],