Skip to content

Commit

Permalink
Clarify masking of bits in Field::random impls
Browse files Browse the repository at this point in the history
Co-Authored-By: Daira Hopwood <[email protected]>
  • Loading branch information
str4d and daira authored Jul 26, 2019
1 parent c4e14ad commit 0255dca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ff/ff_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ fn prime_field_impl(
#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;

if tmp.is_valid() {
Expand Down
2 changes: 1 addition & 1 deletion sapling-crypto/src/jubjub/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ impl Field for Fs {
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;

if tmp.is_valid() {
Expand Down

0 comments on commit 0255dca

Please sign in to comment.