mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 05:06:44 +01:00
Updated all crates to edition 2024 and set workspace resolver to "3".
`gen` is reserved keyword in 2024. So modigied `galois_element` function in base2k/src/module.rs for compat
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[workspace]
|
||||
members = ["base2k", "rlwe", "sampling", "utils"]
|
||||
|
||||
resolver = "3"
|
||||
|
||||
[workspace.dependencies]
|
||||
rug = "1.27"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "base2k"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
rug = {workspace = true}
|
||||
|
||||
@@ -3,10 +3,11 @@ use std::path::absolute;
|
||||
fn main() {
|
||||
println!(
|
||||
"cargo:rustc-link-search=native={}",
|
||||
absolute("./spqlios-arithmetic/build/spqlios")
|
||||
absolute("spqlios-arithmetic/build/spqlios")
|
||||
.unwrap()
|
||||
.to_str()
|
||||
.unwrap()
|
||||
);
|
||||
println!("cargo:rustc-link-lib=static=spqlios"); //"cargo:rustc-link-lib=dylib=spqlios"
|
||||
println!("cargo:rustc-link-lib=static=spqlios");
|
||||
// println!("cargo:rustc-link-lib=dylib=spqlios")
|
||||
}
|
||||
|
||||
@@ -65,21 +65,24 @@ impl<B: Backend> Module<B> {
|
||||
(self.n() << 1) as _
|
||||
}
|
||||
|
||||
// Returns GALOISGENERATOR^|gen| * sign(gen)
|
||||
pub fn galois_element(&self, gen: i64) -> i64 {
|
||||
if gen == 0 {
|
||||
// Returns GALOISGENERATOR^|generator| * sign(generator)
|
||||
pub fn galois_element(&self, generator: i64) -> i64 {
|
||||
if generator == 0 {
|
||||
return 1;
|
||||
}
|
||||
((mod_exp_u64(GALOISGENERATOR, gen.abs() as usize) & (self.cyclotomic_order() - 1)) as i64) * gen.signum()
|
||||
((mod_exp_u64(GALOISGENERATOR, generator.abs() as usize) & (self.cyclotomic_order() - 1)) as i64) * generator.signum()
|
||||
}
|
||||
|
||||
// Returns gen^-1
|
||||
pub fn galois_element_inv(&self, gen: i64) -> i64 {
|
||||
if gen == 0 {
|
||||
pub fn galois_element_inv(&self, generator: i64) -> i64 {
|
||||
if generator == 0 {
|
||||
panic!("cannot invert 0")
|
||||
}
|
||||
((mod_exp_u64(gen.abs() as u64, (self.cyclotomic_order() - 1) as usize) & (self.cyclotomic_order() - 1)) as i64)
|
||||
* gen.signum()
|
||||
((mod_exp_u64(
|
||||
generator.abs() as u64,
|
||||
(self.cyclotomic_order() - 1) as usize,
|
||||
) & (self.cyclotomic_order() - 1)) as i64)
|
||||
* generator.signum()
|
||||
}
|
||||
|
||||
pub fn free(self) {
|
||||
|
||||
Reference in New Issue
Block a user