use crate::deps::*;
use crate::flint::*;
use crate::fmpz_mod_types::*;
#[repr(C)]
pub struct fmpz_mod_discrete_log_pohlig_hellman_table_entry_struct {
pub gammapow: fmpz_t,
pub cm: ulong,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of fmpz_mod_discrete_log_pohlig_hellman_table_entry_struct"][::std::mem::size_of::<
fmpz_mod_discrete_log_pohlig_hellman_table_entry_struct,
>() - 16usize];
["Alignment of fmpz_mod_discrete_log_pohlig_hellman_table_entry_struct"][::std::mem::align_of::<
fmpz_mod_discrete_log_pohlig_hellman_table_entry_struct,
>() - 8usize];
["Offset of field: fmpz_mod_discrete_log_pohlig_hellman_table_entry_struct::gammapow"][::std::mem::offset_of!(
fmpz_mod_discrete_log_pohlig_hellman_table_entry_struct,
gammapow
)
- 0usize];
["Offset of field: fmpz_mod_discrete_log_pohlig_hellman_table_entry_struct::cm"][::std::mem::offset_of!(
fmpz_mod_discrete_log_pohlig_hellman_table_entry_struct,
cm
) - 8usize];
};
impl Default for fmpz_mod_discrete_log_pohlig_hellman_table_entry_struct {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[repr(C)]
pub struct fmpz_mod_discrete_log_pohlig_hellman_entry_struct {
pub exp: slong,
pub prime: ulong,
pub gamma: fmpz_t,
pub gammainv: fmpz_t,
pub startingbeta: fmpz_t,
pub co: fmpz_t,
pub startinge: fmpz_t,
pub idem: fmpz_t,
pub cbound: ulong,
pub dbound: ulong,
pub table: *mut fmpz_mod_discrete_log_pohlig_hellman_table_entry_struct,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of fmpz_mod_discrete_log_pohlig_hellman_entry_struct"]
[::std::mem::size_of::<fmpz_mod_discrete_log_pohlig_hellman_entry_struct>() - 88usize];
["Alignment of fmpz_mod_discrete_log_pohlig_hellman_entry_struct"]
[::std::mem::align_of::<fmpz_mod_discrete_log_pohlig_hellman_entry_struct>() - 8usize];
["Offset of field: fmpz_mod_discrete_log_pohlig_hellman_entry_struct::exp"]
[::std::mem::offset_of!(fmpz_mod_discrete_log_pohlig_hellman_entry_struct, exp) - 0usize];
["Offset of field: fmpz_mod_discrete_log_pohlig_hellman_entry_struct::prime"]
[::std::mem::offset_of!(fmpz_mod_discrete_log_pohlig_hellman_entry_struct, prime) - 8usize];
["Offset of field: fmpz_mod_discrete_log_pohlig_hellman_entry_struct::gamma"][::std::mem::offset_of!(
fmpz_mod_discrete_log_pohlig_hellman_entry_struct,
gamma
) - 16usize];
["Offset of field: fmpz_mod_discrete_log_pohlig_hellman_entry_struct::gammainv"][::std::mem::offset_of!(
fmpz_mod_discrete_log_pohlig_hellman_entry_struct,
gammainv
) - 24usize];
["Offset of field: fmpz_mod_discrete_log_pohlig_hellman_entry_struct::startingbeta"][::std::mem::offset_of!(
fmpz_mod_discrete_log_pohlig_hellman_entry_struct,
startingbeta
)
- 32usize];
["Offset of field: fmpz_mod_discrete_log_pohlig_hellman_entry_struct::co"]
[::std::mem::offset_of!(fmpz_mod_discrete_log_pohlig_hellman_entry_struct, co) - 40usize];
["Offset of field: fmpz_mod_discrete_log_pohlig_hellman_entry_struct::startinge"][::std::mem::offset_of!(
fmpz_mod_discrete_log_pohlig_hellman_entry_struct,
startinge
) - 48usize];
["Offset of field: fmpz_mod_discrete_log_pohlig_hellman_entry_struct::idem"]
[::std::mem::offset_of!(fmpz_mod_discrete_log_pohlig_hellman_entry_struct, idem) - 56usize];
["Offset of field: fmpz_mod_discrete_log_pohlig_hellman_entry_struct::cbound"][::std::mem::offset_of!(
fmpz_mod_discrete_log_pohlig_hellman_entry_struct,
cbound
) - 64usize];
["Offset of field: fmpz_mod_discrete_log_pohlig_hellman_entry_struct::dbound"][::std::mem::offset_of!(
fmpz_mod_discrete_log_pohlig_hellman_entry_struct,
dbound
) - 72usize];
["Offset of field: fmpz_mod_discrete_log_pohlig_hellman_entry_struct::table"][::std::mem::offset_of!(
fmpz_mod_discrete_log_pohlig_hellman_entry_struct,
table
) - 80usize];
};
impl Default for fmpz_mod_discrete_log_pohlig_hellman_entry_struct {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[repr(C)]
pub struct fmpz_mod_discrete_log_pohlig_hellman_struct {
pub fpctx: fmpz_mod_ctx_t,
pub pm1: fmpz_t,
pub alpha: fmpz_t,
pub alphainv: fmpz_t,
pub num_factors: slong,
pub entries: *mut fmpz_mod_discrete_log_pohlig_hellman_entry_struct,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of fmpz_mod_discrete_log_pohlig_hellman_struct"]
[::std::mem::size_of::<fmpz_mod_discrete_log_pohlig_hellman_struct>() - 152usize];
["Alignment of fmpz_mod_discrete_log_pohlig_hellman_struct"]
[::std::mem::align_of::<fmpz_mod_discrete_log_pohlig_hellman_struct>() - 8usize];
["Offset of field: fmpz_mod_discrete_log_pohlig_hellman_struct::fpctx"]
[::std::mem::offset_of!(fmpz_mod_discrete_log_pohlig_hellman_struct, fpctx) - 0usize];
["Offset of field: fmpz_mod_discrete_log_pohlig_hellman_struct::pm1"]
[::std::mem::offset_of!(fmpz_mod_discrete_log_pohlig_hellman_struct, pm1) - 112usize];
["Offset of field: fmpz_mod_discrete_log_pohlig_hellman_struct::alpha"]
[::std::mem::offset_of!(fmpz_mod_discrete_log_pohlig_hellman_struct, alpha) - 120usize];
["Offset of field: fmpz_mod_discrete_log_pohlig_hellman_struct::alphainv"]
[::std::mem::offset_of!(fmpz_mod_discrete_log_pohlig_hellman_struct, alphainv) - 128usize];
["Offset of field: fmpz_mod_discrete_log_pohlig_hellman_struct::num_factors"][::std::mem::offset_of!(
fmpz_mod_discrete_log_pohlig_hellman_struct,
num_factors
) - 136usize];
["Offset of field: fmpz_mod_discrete_log_pohlig_hellman_struct::entries"]
[::std::mem::offset_of!(fmpz_mod_discrete_log_pohlig_hellman_struct, entries) - 144usize];
};
impl Default for fmpz_mod_discrete_log_pohlig_hellman_struct {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
pub type fmpz_mod_discrete_log_pohlig_hellman_t =
[fmpz_mod_discrete_log_pohlig_hellman_struct; 1usize];
extern "C" {
pub fn fmpz_mod_ctx_init(ctx: *mut fmpz_mod_ctx_struct, n: *const fmpz);
pub fn fmpz_mod_ctx_init_ui(ctx: *mut fmpz_mod_ctx_struct, n: ulong);
pub fn fmpz_mod_ctx_init_rand_bits(
ctx: *mut fmpz_mod_ctx_struct,
state: *mut flint_rand_struct,
max_bits: flint_bitcnt_t,
);
pub fn fmpz_mod_ctx_init_rand_bits_prime(
ctx: *mut fmpz_mod_ctx_struct,
state: *mut flint_rand_struct,
max_bits: flint_bitcnt_t,
);
pub fn fmpz_mod_ctx_clear(ctx: *mut fmpz_mod_ctx_struct);
#[link_name = "fmpz_mod_ctx_modulus__extern"]
pub fn fmpz_mod_ctx_modulus(ctx: *const fmpz_mod_ctx_struct) -> *const fmpz;
pub fn fmpz_mod_ctx_set_modulus(ctx: *mut fmpz_mod_ctx_struct, n: *const fmpz);
pub fn fmpz_mod_ctx_set_modulus_ui(ctx: *mut fmpz_mod_ctx_struct, n: ulong);
pub fn fmpz_mod_is_canonical(a: *const fmpz, ctx: *const fmpz_mod_ctx_struct) -> libc::c_int;
pub fn fmpz_mod_assert_canonical(a: *const fmpz, ctx: *const fmpz_mod_ctx_struct);
pub fn fmpz_mod_is_one(a: *const fmpz, ctx: *const fmpz_mod_ctx_struct) -> libc::c_int;
pub fn fmpz_mod_equal_fmpz(
a: *const fmpz,
b: *const fmpz,
ctx: *const fmpz_mod_ctx_struct,
) -> libc::c_int;
pub fn fmpz_mod_equal_si(
a: *const fmpz,
b: slong,
ctx: *const fmpz_mod_ctx_struct,
) -> libc::c_int;
pub fn fmpz_mod_set_fmpz(a: *mut fmpz, b: *const fmpz, ctx: *const fmpz_mod_ctx_struct);
pub fn fmpz_mod_set_ui(a: *mut fmpz, b: ulong, ctx: *const fmpz_mod_ctx_struct);
pub fn fmpz_mod_set_si(a: *mut fmpz, b: slong, ctx: *const fmpz_mod_ctx_struct);
pub fn _fmpz_mod_add1(
a: *mut fmpz,
b: *const fmpz,
c: *const fmpz,
ctx: *const fmpz_mod_ctx_struct,
);
pub fn _fmpz_mod_add2s(
a: *mut fmpz,
b: *const fmpz,
c: *const fmpz,
UNUSED_ctx: *const fmpz_mod_ctx_struct,
);
pub fn _fmpz_mod_add2(
a: *mut fmpz,
b: *const fmpz,
c: *const fmpz,
ctx: *const fmpz_mod_ctx_struct,
);
pub fn _fmpz_mod_addN(
a: *mut fmpz,
b: *const fmpz,
c: *const fmpz,
ctx: *const fmpz_mod_ctx_struct,
);
#[link_name = "fmpz_mod_add__extern"]
pub fn fmpz_mod_add(
a: *mut fmpz,
b: *const fmpz,
c: *const fmpz,
ctx: *const fmpz_mod_ctx_struct,
);
pub fn fmpz_mod_add_fmpz(
a: *mut fmpz,
b: *const fmpz,
c: *const fmpz,
ctx: *const fmpz_mod_ctx_struct,
);
pub fn fmpz_mod_add_ui(a: *mut fmpz, b: *const fmpz, c: ulong, ctx: *const fmpz_mod_ctx_struct);
pub fn fmpz_mod_add_si(a: *mut fmpz, b: *const fmpz, c: slong, ctx: *const fmpz_mod_ctx_struct);
pub fn _fmpz_mod_sub1(
a: *mut fmpz,
b: *const fmpz,
c: *const fmpz,
ctx: *const fmpz_mod_ctx_struct,
);
pub fn _fmpz_mod_sub2s(
a: *mut fmpz,
b: *const fmpz,
c: *const fmpz,
UNUSED_ctx: *const fmpz_mod_ctx_struct,
);
pub fn _fmpz_mod_sub2(
a: *mut fmpz,
b: *const fmpz,
c: *const fmpz,
ctx: *const fmpz_mod_ctx_struct,
);
pub fn _fmpz_mod_subN(
a: *mut fmpz,
b: *const fmpz,
c: *const fmpz,
ctx: *const fmpz_mod_ctx_struct,
);
#[link_name = "fmpz_mod_sub__extern"]
pub fn fmpz_mod_sub(
a: *mut fmpz,
b: *const fmpz,
c: *const fmpz,
ctx: *const fmpz_mod_ctx_struct,
);
pub fn fmpz_mod_sub_fmpz(
a: *mut fmpz,
b: *const fmpz,
c: *const fmpz,
ctx: *const fmpz_mod_ctx_struct,
);
pub fn fmpz_mod_sub_ui(a: *mut fmpz, b: *const fmpz, c: ulong, ctx: *const fmpz_mod_ctx_struct);
pub fn fmpz_mod_sub_si(a: *mut fmpz, b: *const fmpz, c: slong, ctx: *const fmpz_mod_ctx_struct);
pub fn fmpz_mod_fmpz_sub(
a: *mut fmpz,
b: *const fmpz,
c: *const fmpz,
ctx: *const fmpz_mod_ctx_struct,
);
pub fn fmpz_mod_ui_sub(a: *mut fmpz, b: ulong, c: *const fmpz, ctx: *const fmpz_mod_ctx_struct);
pub fn fmpz_mod_si_sub(a: *mut fmpz, b: slong, c: *const fmpz, ctx: *const fmpz_mod_ctx_struct);
pub fn fmpz_mod_neg(a: *mut fmpz, b: *const fmpz, ctx: *const fmpz_mod_ctx_struct);
pub fn _fmpz_mod_mul1(
a: *mut fmpz,
b: *const fmpz,
c: *const fmpz,
ctx: *const fmpz_mod_ctx_struct,
);
pub fn _fmpz_mod_mul2s(
a: *mut fmpz,
b: *const fmpz,
c: *const fmpz,
UNUSED_ctx: *const fmpz_mod_ctx_struct,
);
pub fn _fmpz_mod_mul2(
a: *mut fmpz,
b: *const fmpz,
c: *const fmpz,
ctx: *const fmpz_mod_ctx_struct,
);
pub fn _fmpz_mod_mulN(
a: *mut fmpz,
b: *const fmpz,
c: *const fmpz,
ctx: *const fmpz_mod_ctx_struct,
);
#[link_name = "fmpz_mod_mul__extern"]
pub fn fmpz_mod_mul(
a: *mut fmpz,
b: *const fmpz,
c: *const fmpz,
ctx: *const fmpz_mod_ctx_struct,
);
pub fn fmpz_mod_mul_fmpz(
a: *mut fmpz,
b: *const fmpz,
c: *const fmpz,
ctx: *const fmpz_mod_ctx_struct,
);
pub fn fmpz_mod_mul_ui(a: *mut fmpz, b: *const fmpz, c: ulong, ctx: *const fmpz_mod_ctx_struct);
pub fn fmpz_mod_mul_si(a: *mut fmpz, b: *const fmpz, c: slong, ctx: *const fmpz_mod_ctx_struct);
pub fn fmpz_mod_addmul(
a: *mut fmpz,
b: *const fmpz,
c: *const fmpz,
d: *const fmpz,
ctx: *const fmpz_mod_ctx_struct,
);
pub fn fmpz_mod_is_invertible(a: *const fmpz, ctx: *const fmpz_mod_ctx_struct) -> libc::c_int;
pub fn fmpz_mod_inv(a: *mut fmpz, b: *const fmpz, ctx: *const fmpz_mod_ctx_struct);
pub fn fmpz_mod_divides(
a: *mut fmpz,
b: *const fmpz,
c: *const fmpz,
ctx: *const fmpz_mod_ctx_struct,
) -> libc::c_int;
pub fn fmpz_mod_pow_ui(
a: *mut fmpz,
b: *const fmpz,
pow: ulong,
ctx: *const fmpz_mod_ctx_struct,
);
pub fn fmpz_mod_pow_fmpz(
a: *mut fmpz,
b: *const fmpz,
pow: *const fmpz,
ctx: *const fmpz_mod_ctx_struct,
) -> libc::c_int;
pub fn fmpz_mod_rand(
a: *mut fmpz,
state: *mut flint_rand_struct,
ctx: *const fmpz_mod_ctx_struct,
);
pub fn fmpz_mod_rand_not_zero(
a: *mut fmpz,
state: *mut flint_rand_struct,
ctx: *const fmpz_mod_ctx_struct,
);
pub fn fmpz_mod_discrete_log_pohlig_hellman_init(
L: *mut fmpz_mod_discrete_log_pohlig_hellman_struct,
);
pub fn fmpz_mod_discrete_log_pohlig_hellman_clear(
L: *mut fmpz_mod_discrete_log_pohlig_hellman_struct,
);
pub fn fmpz_mod_discrete_log_pohlig_hellman_precompute_prime(
L: *mut fmpz_mod_discrete_log_pohlig_hellman_struct,
p: *const fmpz,
) -> f64;
pub fn fmpz_mod_discrete_log_pohlig_hellman_run(
x: *mut fmpz,
L: *const fmpz_mod_discrete_log_pohlig_hellman_struct,
y: *const fmpz,
);
#[link_name = "fmpz_mod_discrete_log_pohlig_hellman_primitive_root__extern"]
pub fn fmpz_mod_discrete_log_pohlig_hellman_primitive_root(
L: *mut fmpz_mod_discrete_log_pohlig_hellman_struct,
) -> *const fmpz;
pub fn fmpz_next_smooth_prime(a: *mut fmpz, b: *const fmpz) -> libc::c_int;
}