bigint: make sure bigand is normalized
This commit is contained in:
parent
952dba4e06
commit
3c1c84307c
|
@ -288,6 +288,7 @@ impl<'a> BitAndAssign<&'a BigUint> for BigUint {
|
||||||
*ai &= bi;
|
*ai &= bi;
|
||||||
}
|
}
|
||||||
self.data.truncate(other.data.len());
|
self.data.truncate(other.data.len());
|
||||||
|
self.normalize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -203,6 +203,8 @@ const BIT_TESTS: &'static [(&'static [BigDigit],
|
||||||
&'static [BigDigit],
|
&'static [BigDigit],
|
||||||
&'static [BigDigit])] = &[// LEFT RIGHT AND OR XOR
|
&'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],
|
(&[268, 482, 17],
|
||||||
&[964, 54],
|
&[964, 54],
|
||||||
&[260, 34],
|
&[260, 34],
|
||||||
|
|
Loading…
Reference in New Issue