From 0255dca16e5f699770c8d99537cbc783623e9267 Mon Sep 17 00:00:00 2001 From: str4d Date: Fri, 26 Jul 2019 19:43:42 +0100 Subject: [PATCH] Clarify masking of bits in Field::random impls Co-Authored-By: Daira Hopwood --- ff/ff_derive/src/lib.rs | 2 +- sapling-crypto/src/jubjub/fs.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ff/ff_derive/src/lib.rs b/ff/ff_derive/src/lib.rs index aea7a50..df2625b 100644 --- a/ff/ff_derive/src/lib.rs +++ b/ff/ff_derive/src/lib.rs @@ -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() { diff --git a/sapling-crypto/src/jubjub/fs.rs b/sapling-crypto/src/jubjub/fs.rs index 017292b..baa16ef 100644 --- a/sapling-crypto/src/jubjub/fs.rs +++ b/sapling-crypto/src/jubjub/fs.rs @@ -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() {