Skip to content

Commit

Permalink
revert extend_from_slice to extend
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicole authored and Nicole committed Jan 22, 2025
1 parent 1eff548 commit 9f5f92c
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions math/src/field/fields/fft_friendly/quartic_babybear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,18 +221,18 @@ impl ByteConversion for [FieldElement<Babybear31PrimeField>; 4] {
#[cfg(feature = "alloc")]
fn to_bytes_be(&self) -> alloc::vec::Vec<u8> {
let mut byte_slice = ByteConversion::to_bytes_be(&self[0]);
byte_slice.extend_from_slice(&ByteConversion::to_bytes_be(&self[1]));
byte_slice.extend_from_slice(&ByteConversion::to_bytes_be(&self[2]));
byte_slice.extend_from_slice(&ByteConversion::to_bytes_be(&self[3]));
byte_slice.extend(ByteConversion::to_bytes_be(&self[1]));
byte_slice.extend(ByteConversion::to_bytes_be(&self[2]));
byte_slice.extend(ByteConversion::to_bytes_be(&self[3]));
byte_slice
}

#[cfg(feature = "alloc")]
fn to_bytes_le(&self) -> alloc::vec::Vec<u8> {
let mut byte_slice = ByteConversion::to_bytes_le(&self[0]);
byte_slice.extend_from_slice(&ByteConversion::to_bytes_le(&self[1]));
byte_slice.extend_from_slice(&ByteConversion::to_bytes_le(&self[2]));
byte_slice.extend_from_slice(&ByteConversion::to_bytes_le(&self[3]));
byte_slice.extend(ByteConversion::to_bytes_le(&self[1]));
byte_slice.extend(ByteConversion::to_bytes_le(&self[2]));
byte_slice.extend(ByteConversion::to_bytes_le(&self[3]));
byte_slice
}

Expand Down Expand Up @@ -269,17 +269,17 @@ impl ByteConversion for [FieldElement<Babybear31PrimeField>; 4] {
impl ByteConversion for FieldElement<Degree4BabyBearExtensionField> {
fn to_bytes_be(&self) -> alloc::vec::Vec<u8> {
let mut byte_slice = ByteConversion::to_bytes_be(&self.value()[0]);
byte_slice.extend_from_slice(&ByteConversion::to_bytes_be(&self.value()[1]));
byte_slice.extend_from_slice(&ByteConversion::to_bytes_be(&self.value()[2]));
byte_slice.extend_from_slice(&ByteConversion::to_bytes_be(&self.value()[3]));
byte_slice.extend(ByteConversion::to_bytes_be(&self.value()[1]));
byte_slice.extend(ByteConversion::to_bytes_be(&self.value()[2]));
byte_slice.extend(ByteConversion::to_bytes_be(&self.value()[3]));
byte_slice
}

fn to_bytes_le(&self) -> alloc::vec::Vec<u8> {
let mut byte_slice = ByteConversion::to_bytes_le(&self.value()[0]);
byte_slice.extend_from_slice(&ByteConversion::to_bytes_le(&self.value()[1]));
byte_slice.extend_from_slice(&ByteConversion::to_bytes_le(&self.value()[2]));
byte_slice.extend_from_slice(&ByteConversion::to_bytes_le(&self.value()[3]));
byte_slice.extend(ByteConversion::to_bytes_le(&self.value()[1]));
byte_slice.extend(ByteConversion::to_bytes_le(&self.value()[2]));
byte_slice.extend(ByteConversion::to_bytes_le(&self.value()[3]));
byte_slice
}

Expand Down

0 comments on commit 9f5f92c

Please sign in to comment.