Skip to content

Commit 9e83786

Browse files
author
lakshya-sky
committed
Remove EmptyFlags construction checks
arkworks-rs#394
1 parent 27e7b3a commit 9e83786

2 files changed

Lines changed: 4 additions & 9 deletions

File tree

ff/src/fields/macros.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ macro_rules! impl_prime_field_serializer {
1313
}
1414

1515
// Calculate the number of bytes required to represent a field element
16-
// serialized with `flags`. If `F::BIT_SIZE < 8`,
17-
// this is at most `$byte_size + 1`
18-
let output_byte_size = buffer_byte_size(P::MODULUS_BITS as usize + F::BIT_SIZE);
16+
// serialized with `flags`.
17+
let output_byte_size = Self::zero().serialized_size_with_flags::<F>();
1918

2019
// Write out `self` to a temporary buffer.
2120
// The size of the buffer is $byte_size + 1 because `F::BIT_SIZE`

serialize/src/flags.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,8 @@ impl Flags for EmptyFlags {
5151
}
5252

5353
#[inline]
54-
fn from_u8(value: u8) -> Option<Self> {
55-
if (value >> 7) == 0 {
56-
Some(EmptyFlags)
57-
} else {
58-
None
59-
}
54+
fn from_u8(_: u8) -> Option<Self> {
55+
Some(EmptyFlags)
6056
}
6157
}
6258

0 commit comments

Comments
 (0)