You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
611 B

use alloc::vec::Vec;
use plonky2::util::serialization::{Buffer, IoResult, Read, Write};
use crate::gadgets::arithmetic_u32::U32Target;
pub trait WriteU32 {
fn write_target_u32(&mut self, x: U32Target) -> IoResult<()>;
}
impl WriteU32 for Vec<u8> {
#[inline]
fn write_target_u32(&mut self, x: U32Target) -> IoResult<()> {
self.write_target(x.0)
}
}
pub trait ReadU32 {
fn read_target_u32(&mut self) -> IoResult<U32Target>;
}
impl ReadU32 for Buffer<'_> {
#[inline]
fn read_target_u32(&mut self) -> IoResult<U32Target> {
Ok(U32Target(self.read_target()?))
}
}