Apply suggestion by @hdevalence

Co-Authored-By: Henry de Valence <hdevalence@hdevalence.ca>
This commit is contained in:
Fabian Drinck 2019-08-07 19:43:10 +02:00 committed by GitHub
parent 53da2aaaf4
commit 26ae185bc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -190,7 +190,8 @@ impl CompressedEdwardsY {
if is_valid_y_coord.unwrap_u8() != 1u8 { return None; }
// Flip the sign of X if it's not correct
// FieldElement::sqrt_ratio_i always returns the nonnegative square root,
// so we negate according to the supplied sign bit.
let compressed_sign_bit = Choice::from(self.as_bytes()[31] >> 7);
X.conditional_negate(compressed_sign_bit);