mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 05:06:44 +01:00
wip on BR + added enc/dec for LWE
This commit is contained in:
@@ -103,7 +103,7 @@ fn alloc_aligned_custom_u8(size: usize, align: usize) -> Vec<u8> {
|
||||
/// Size of T * size msut be a multiple of [DEFAULTALIGN].
|
||||
pub fn alloc_aligned_custom<T>(size: usize, align: usize) -> Vec<T> {
|
||||
assert_eq!(
|
||||
(size * size_of::<T>()) % align,
|
||||
(size * size_of::<T>()) % (align/ size_of::<T>()),
|
||||
0,
|
||||
"size={} must be a multiple of align={}",
|
||||
size,
|
||||
@@ -121,7 +121,7 @@ pub fn alloc_aligned_custom<T>(size: usize, align: usize) -> Vec<T> {
|
||||
/// of [DEFAULTALIGN]/size_of::<T>() that is equal or greater to `size`.
|
||||
pub fn alloc_aligned<T>(size: usize) -> Vec<T> {
|
||||
alloc_aligned_custom::<T>(
|
||||
size + (size % (DEFAULTALIGN / size_of::<T>())),
|
||||
size + (DEFAULTALIGN - (size % (DEFAULTALIGN / size_of::<T>()))),
|
||||
DEFAULTALIGN,
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user