mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 21:26:41 +01:00
wip on generic traits
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use crate::ciphertext::Ciphertext;
|
||||
use crate::elem::{Elem, ElemVecZnx, VecZnxCommon};
|
||||
use crate::parameters::Parameters;
|
||||
use base2k::{Infos, Module, VecZnx, VecZnxApi};
|
||||
use base2k::{Module, VecZnx};
|
||||
|
||||
pub struct Plaintext<T>(pub Elem<T>);
|
||||
|
||||
@@ -12,16 +12,16 @@ impl Parameters {
|
||||
|
||||
pub fn bytes_of_plaintext<T>(&self, log_q: usize) -> usize
|
||||
where
|
||||
T: VecZnxCommon,
|
||||
Elem<T>: Infos + ElemVecZnx<T>,
|
||||
T: VecZnxCommon<Owned = T>,
|
||||
Elem<T>: ElemVecZnx<T>,
|
||||
{
|
||||
Elem::<T>::bytes_of(self.module(), self.log_base2k(), log_q, 1)
|
||||
}
|
||||
|
||||
pub fn plaintext_from_bytes<T>(&self, log_q: usize, bytes: &mut [u8]) -> Plaintext<T>
|
||||
where
|
||||
T: VecZnxCommon,
|
||||
Elem<T>: Infos + ElemVecZnx<T>,
|
||||
T: VecZnxCommon<Owned = T>,
|
||||
Elem<T>: ElemVecZnx<T>,
|
||||
{
|
||||
Plaintext::<T>(self.elem_from_bytes::<T>(log_q, 1, bytes))
|
||||
}
|
||||
@@ -35,8 +35,8 @@ impl Plaintext<VecZnx> {
|
||||
|
||||
impl<T> Plaintext<T>
|
||||
where
|
||||
T: VecZnxCommon,
|
||||
Elem<T>: Infos + ElemVecZnx<T>,
|
||||
T: VecZnxCommon<Owned = T>,
|
||||
Elem<T>: ElemVecZnx<T>,
|
||||
{
|
||||
pub fn bytes_of(module: &Module, log_base2k: usize, log_q: usize) -> usize {
|
||||
Elem::<T>::bytes_of(module, log_base2k, log_q, 1)
|
||||
|
||||
Reference in New Issue
Block a user