mirror of
https://github.com/arnaucube/plonky2-u32.git
synced 2026-02-10 13:16:46 +01:00
some minor changes
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use alloc::string::{String, ToString};
|
||||
use alloc::vec;
|
||||
use alloc::vec::Vec;
|
||||
use plonky2::util::serialization::{IoResult, Buffer, Read, Write};
|
||||
use plonky2::util::serialization::{Buffer, IoResult, Read, Write};
|
||||
use core::marker::PhantomData;
|
||||
|
||||
use plonky2::field::extension::Extendable;
|
||||
@@ -14,7 +14,7 @@ use plonky2::plonk::circuit_builder::CircuitBuilder;
|
||||
use crate::gates::add_many_u32::U32AddManyGate;
|
||||
use crate::gates::arithmetic_u32::U32ArithmeticGate;
|
||||
use crate::gates::subtraction_u32::U32SubtractionGate;
|
||||
use crate::serialization::{WriteU32, ReadU32};
|
||||
use crate::serialization::{ReadU32, WriteU32};
|
||||
use crate::witness::GeneratedValuesU32;
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
@@ -274,7 +274,6 @@ impl<F: RichField + Extendable<D>, const D: usize> SimpleGenerator<F>
|
||||
out_buffer.set_u32_target(self.low, low);
|
||||
out_buffer.set_u32_target(self.high, high);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use alloc::format;
|
||||
use alloc::string::{String, ToString};
|
||||
use alloc::vec::Vec;
|
||||
use plonky2::util::serialization::{IoResult, Buffer, Write, Read};
|
||||
use plonky2::util::serialization::{Buffer, IoResult, Read, Write};
|
||||
use core::marker::PhantomData;
|
||||
|
||||
use itertools::unfold;
|
||||
|
||||
@@ -216,13 +216,13 @@ impl<F: RichField + Extendable<D>, const D: usize> SimpleGenerator<F>
|
||||
}
|
||||
|
||||
fn serialize(&self, dst: &mut Vec<u8>) -> IoResult<()> {
|
||||
dst.write_usize(self.row)?;
|
||||
self.gate.serialize(dst)
|
||||
self.gate.serialize(dst)?;
|
||||
dst.write_usize(self.row)
|
||||
}
|
||||
|
||||
fn deserialize(src: &mut Buffer) -> IoResult<Self> {
|
||||
let row = src.read_usize()?;
|
||||
let gate = U32RangeCheckGate::deserialize(src)?;
|
||||
let row = src.read_usize()?;
|
||||
Ok(Self { row, gate })
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ impl WriteU32 for Vec<u8> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
pub trait ReadU32 {
|
||||
fn read_target_u32(&mut self) -> IoResult<U32Target>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user