This commit is contained in:
Pro7ech
2025-10-12 21:34:10 +02:00
parent f72363cc4b
commit 662e533eac
32 changed files with 1594 additions and 787 deletions

View File

@@ -1,6 +1,6 @@
use poulpy_hal::{
api::{VmpPMatAlloc, VmpPMatAllocBytes, VmpPrepare, VmpPrepareTmpBytes},
layouts::{Backend, Data, DataMut, DataRef, Module, Scratch, VmpPMat, VmpPMatToRef, ZnxInfos},
layouts::{Backend, Data, DataMut, DataRef, Module, Scratch, VmpPMat, VmpPMatToMut, VmpPMatToRef, ZnxInfos},
oep::VmpPMatAllocBytesImpl,
};
@@ -295,6 +295,22 @@ where
}
}
pub trait GGSWCiphertextPreparedToMut<B: Backend> {
fn to_ref(&mut self) -> GGSWCiphertextPrepared<&mut [u8], B>;
}
impl<D: DataMut, B: Backend> GGSWCiphertextPreparedToMut<B> for GGSWCiphertextPrepared<D, B> {
fn to_ref(&mut self) -> GGSWCiphertextPrepared<&mut [u8], B> {
GGSWCiphertextPrepared::builder()
.base2k(self.base2k())
.dsize(self.dsize())
.k(self.k())
.data(self.data.to_mut())
.build()
.unwrap()
}
}
pub trait GGSWCiphertextPreparedToRef<B: Backend> {
fn to_ref(&self) -> GGSWCiphertextPrepared<&[u8], B>;
}