Clarify masking of bits in Field::random impls
Co-Authored-By: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
c4e14ad0b1
commit
0255dca16e
|
@ -892,7 +892,7 @@ fn prime_field_impl(
|
||||||
#name(#repr(repr))
|
#name(#repr(repr))
|
||||||
};
|
};
|
||||||
|
|
||||||
// Mask away the unused bits at the beginning.
|
// Mask away the unused most-significant bits.
|
||||||
tmp.0.as_mut()[#top_limb_index] &= 0xffffffffffffffff >> REPR_SHAVE_BITS;
|
tmp.0.as_mut()[#top_limb_index] &= 0xffffffffffffffff >> REPR_SHAVE_BITS;
|
||||||
|
|
||||||
if tmp.is_valid() {
|
if tmp.is_valid() {
|
||||||
|
|
|
@ -292,7 +292,7 @@ impl Field for Fs {
|
||||||
Fs(FsRepr(repr))
|
Fs(FsRepr(repr))
|
||||||
};
|
};
|
||||||
|
|
||||||
// Mask away the unused bits at the beginning.
|
// Mask away the unused most-significant bits.
|
||||||
tmp.0.as_mut()[3] &= 0xffffffffffffffff >> REPR_SHAVE_BITS;
|
tmp.0.as_mut()[3] &= 0xffffffffffffffff >> REPR_SHAVE_BITS;
|
||||||
|
|
||||||
if tmp.is_valid() {
|
if tmp.is_valid() {
|
||||||
|
|
Loading…
Reference in New Issue