flint-sys 0.9.0

Bindings to the FLINT C library
Documentation
/* automatically generated by rust-bindgen 0.70.1 */

use libc::*;
use crate::deps::*;


pub const FLINT_HAVE_VA_LIST: u32 = 1;
pub const FLINT_HAVE_FILE: u32 = 1;
pub const __FLINT_VERSION: u32 = 3;
pub const __FLINT_VERSION_MINOR: u32 = 5;
pub const __FLINT_VERSION_PATCHLEVEL: u32 = 0;
#[allow(unsafe_code)]
pub const FLINT_VERSION: &::std::ffi::CStr =
    unsafe { ::std::ffi::CStr::from_bytes_with_nul_unchecked(b"3.5.0\0") };
#[allow(unsafe_code)]
pub const _WORD_FMT: &::std::ffi::CStr =
    unsafe { ::std::ffi::CStr::from_bytes_with_nul_unchecked(b"l\0") };
#[allow(unsafe_code)]
pub const WORD_FMT: &::std::ffi::CStr =
    unsafe { ::std::ffi::CStr::from_bytes_with_nul_unchecked(b"%l\0") };
#[allow(unsafe_code)]
pub const WORD_WIDTH_FMT: &::std::ffi::CStr =
    unsafe { ::std::ffi::CStr::from_bytes_with_nul_unchecked(b"%*l\0") };
pub const FLINT_D_BITS: u32 = 53;
pub const FLINT64: u32 = 1;
pub const SMALL_FMPZ_BITCOUNT_MAX: u32 = 62;
pub const MPZ_MIN_ALLOC: u32 = 2;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __FLINT_FILE {
    _unused: [u8; 0],
}
pub type FLINT_FILE = __FLINT_FILE;
pub type flint_bitcnt_t = ulong;
pub type nn_ptr = *mut ulong;
pub type nn_srcptr = *const ulong;
pub type flint_cleanup_function_t = ::std::option::Option<unsafe extern "C" fn()>;
pub type thread_pool_handle = libc::c_int;
#[repr(C)]
pub struct flint_rand_struct {
    pub __gmp_state: *mut libc::c_void,
    pub __randval: ulong,
    pub __randval2: ulong,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of flint_rand_struct"][::std::mem::size_of::<flint_rand_struct>() - 24usize];
    ["Alignment of flint_rand_struct"][::std::mem::align_of::<flint_rand_struct>() - 8usize];
    ["Offset of field: flint_rand_struct::__gmp_state"]
        [::std::mem::offset_of!(flint_rand_struct, __gmp_state) - 0usize];
    ["Offset of field: flint_rand_struct::__randval"]
        [::std::mem::offset_of!(flint_rand_struct, __randval) - 8usize];
    ["Offset of field: flint_rand_struct::__randval2"]
        [::std::mem::offset_of!(flint_rand_struct, __randval2) - 16usize];
};
impl Default for flint_rand_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 flint_rand_t = [flint_rand_struct; 1usize];
pub const flint_err_t_FLINT_ERROR: flint_err_t = 0;
pub const flint_err_t_FLINT_OVERFLOW: flint_err_t = 1;
pub const flint_err_t_FLINT_IMPINV: flint_err_t = 2;
pub const flint_err_t_FLINT_DOMERR: flint_err_t = 3;
pub const flint_err_t_FLINT_DIVZERO: flint_err_t = 4;
pub const flint_err_t_FLINT_EXPOF: flint_err_t = 5;
pub const flint_err_t_FLINT_INEXACT: flint_err_t = 6;
pub const flint_err_t_FLINT_TEST_FAIL: flint_err_t = 7;
pub type flint_err_t = libc::c_uint;
#[repr(C)]
pub struct nmod_t {
    pub n: ulong,
    pub ninv: ulong,
    pub norm: flint_bitcnt_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of nmod_t"][::std::mem::size_of::<nmod_t>() - 24usize];
    ["Alignment of nmod_t"][::std::mem::align_of::<nmod_t>() - 8usize];
    ["Offset of field: nmod_t::n"][::std::mem::offset_of!(nmod_t, n) - 0usize];
    ["Offset of field: nmod_t::ninv"][::std::mem::offset_of!(nmod_t, ninv) - 8usize];
    ["Offset of field: nmod_t::norm"][::std::mem::offset_of!(nmod_t, norm) - 16usize];
};
impl Default for nmod_t {
    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 = slong;
pub type fmpz_t = [fmpz; 1usize];
#[repr(C)]
pub struct fmpq {
    pub num: fmpz,
    pub den: fmpz,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of fmpq"][::std::mem::size_of::<fmpq>() - 16usize];
    ["Alignment of fmpq"][::std::mem::align_of::<fmpq>() - 8usize];
    ["Offset of field: fmpq::num"][::std::mem::offset_of!(fmpq, num) - 0usize];
    ["Offset of field: fmpq::den"][::std::mem::offset_of!(fmpq, den) - 8usize];
};
impl Default for fmpq {
    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 fmpq_t = [fmpq; 1usize];
extern "C" {
    pub static mut flint_version: [libc::c_char; 0usize];
    pub fn flint_malloc(size: usize) -> *mut libc::c_void;
    pub fn flint_realloc(ptr: *mut libc::c_void, size: usize) -> *mut libc::c_void;
    pub fn flint_calloc(num: usize, size: usize) -> *mut libc::c_void;
    pub fn flint_free(ptr: *mut libc::c_void);
    pub fn flint_aligned_alloc(alignment: usize, size: usize) -> *mut libc::c_void;
    pub fn flint_aligned_free(ptr: *mut libc::c_void);
    pub fn flint_register_cleanup_function(cleanup_function: flint_cleanup_function_t);
    pub fn flint_cleanup();
    pub fn flint_cleanup_master();
    pub fn __flint_set_all_memory_functions(
        alloc_func: ::std::option::Option<unsafe extern "C" fn(arg1: usize) -> *mut libc::c_void>,
        calloc_func: ::std::option::Option<
            unsafe extern "C" fn(arg1: usize, arg2: usize) -> *mut libc::c_void,
        >,
        realloc_func: ::std::option::Option<
            unsafe extern "C" fn(arg1: *mut libc::c_void, arg2: usize) -> *mut libc::c_void,
        >,
        free_func: ::std::option::Option<unsafe extern "C" fn(arg1: *mut libc::c_void)>,
        aligned_alloc_func: ::std::option::Option<
            unsafe extern "C" fn(arg1: usize, arg2: usize) -> *mut libc::c_void,
        >,
        aligned_free_func: ::std::option::Option<unsafe extern "C" fn(arg1: *mut libc::c_void)>,
    );
    pub fn __flint_get_all_memory_functions(
        alloc_func: *mut ::std::option::Option<
            unsafe extern "C" fn(arg1: usize) -> *mut libc::c_void,
        >,
        calloc_func: *mut ::std::option::Option<
            unsafe extern "C" fn(arg1: usize, arg2: usize) -> *mut libc::c_void,
        >,
        realloc_func: *mut ::std::option::Option<
            unsafe extern "C" fn(arg1: *mut libc::c_void, arg2: usize) -> *mut libc::c_void,
        >,
        free_func: *mut ::std::option::Option<unsafe extern "C" fn(arg1: *mut libc::c_void)>,
        aligned_alloc_func: *mut ::std::option::Option<
            unsafe extern "C" fn(arg1: usize, arg2: usize) -> *mut libc::c_void,
        >,
        aligned_free_func: *mut ::std::option::Option<
            unsafe extern "C" fn(arg1: *mut libc::c_void),
        >,
    );
    pub fn __flint_set_memory_functions(
        alloc_func: ::std::option::Option<unsafe extern "C" fn(arg1: usize) -> *mut libc::c_void>,
        calloc_func: ::std::option::Option<
            unsafe extern "C" fn(arg1: usize, arg2: usize) -> *mut libc::c_void,
        >,
        realloc_func: ::std::option::Option<
            unsafe extern "C" fn(arg1: *mut libc::c_void, arg2: usize) -> *mut libc::c_void,
        >,
        free_func: ::std::option::Option<unsafe extern "C" fn(arg1: *mut libc::c_void)>,
    );
    pub fn __flint_get_memory_functions(
        alloc_func: *mut ::std::option::Option<
            unsafe extern "C" fn(arg1: usize) -> *mut libc::c_void,
        >,
        calloc_func: *mut ::std::option::Option<
            unsafe extern "C" fn(arg1: usize, arg2: usize) -> *mut libc::c_void,
        >,
        realloc_func: *mut ::std::option::Option<
            unsafe extern "C" fn(arg1: *mut libc::c_void, arg2: usize) -> *mut libc::c_void,
        >,
        free_func: *mut ::std::option::Option<unsafe extern "C" fn(arg1: *mut libc::c_void)>,
    );
    pub fn flint_abort();
    pub fn flint_set_abort(func: ::std::option::Option<unsafe extern "C" fn()>);
    pub fn flint_get_num_threads() -> libc::c_int;
    pub fn flint_set_num_threads(num_threads: libc::c_int);
    pub fn _flint_set_num_workers(num_workers: libc::c_int);
    pub fn flint_set_num_workers(num_workers: libc::c_int) -> libc::c_int;
    pub fn flint_reset_num_workers(max_workers: libc::c_int);
    pub fn flint_set_thread_affinity(cpus: *mut libc::c_int, length: slong) -> libc::c_int;
    pub fn flint_restore_thread_affinity() -> libc::c_int;
    pub fn flint_test_multiplier() -> f64;
    #[link_name = "flint_rand_init__extern"]
    pub fn flint_rand_init(state: *mut flint_rand_struct);
    #[link_name = "flint_rand_set_seed__extern"]
    pub fn flint_rand_set_seed(state: *mut flint_rand_struct, seed1: ulong, seed2: ulong);
    #[link_name = "flint_rand_get_seed__extern"]
    pub fn flint_rand_get_seed(seed1: *mut ulong, seed2: *mut ulong, state: *mut flint_rand_struct);
    #[link_name = "flint_rand_clear__extern"]
    pub fn flint_rand_clear(UNUSED_state: *mut flint_rand_struct);
    pub fn _flint_rand_init_gmp_state(state: *mut flint_rand_struct);
    pub fn _flint_rand_clear_gmp_state(state: *mut flint_rand_struct);
    pub fn flint_randinit(arg1: *mut flint_rand_struct);
    pub fn flint_randclear(arg1: *mut flint_rand_struct);
    pub fn flint_randseed(arg1: *mut flint_rand_struct, arg2: ulong, arg3: ulong);
    pub fn flint_get_randseed(arg1: *mut ulong, arg2: *mut ulong, arg3: *mut flint_rand_struct);
    pub fn flint_rand_alloc() -> *mut flint_rand_struct;
    pub fn flint_rand_free(state: *mut flint_rand_struct);
    pub fn n_randlimb(arg1: *mut flint_rand_struct) -> ulong;
    pub fn n_randtest(arg1: *mut flint_rand_struct) -> ulong;
    pub fn n_randtest_not_zero(arg1: *mut flint_rand_struct) -> ulong;
    pub fn n_randint(state: *mut flint_rand_struct, limit: ulong) -> ulong;
    pub fn flint_merge_sort(
        buf: *mut libc::c_void,
        len: slong,
        size: slong,
        cmp: ::std::option::Option<
            unsafe extern "C" fn(
                arg1: *const libc::c_void,
                arg2: *const libc::c_void,
                arg3: *mut libc::c_void,
            ) -> libc::c_int,
        >,
        data: *mut libc::c_void,
    );
    pub fn flint_sort(
        buf: *mut libc::c_void,
        len: slong,
        size: slong,
        cmp: ::std::option::Option<
            unsafe extern "C" fn(
                arg1: *const libc::c_void,
                arg2: *const libc::c_void,
                arg3: *mut libc::c_void,
            ) -> libc::c_int,
        >,
        data: *mut libc::c_void,
    );
    pub fn parse_fmt(floating: *mut libc::c_int, fmt: *const libc::c_char) -> libc::c_int;
    pub fn flint_printf(str_: *const libc::c_char, ...) -> libc::c_int;
    pub fn flint_sprintf(s: *mut libc::c_char, str_: *const libc::c_char, ...) -> libc::c_int;
    pub fn flint_snprintf(
        s: *mut libc::c_char,
        n: usize,
        str_: *const libc::c_char,
        ...
    ) -> libc::c_int;
    pub fn flint_scanf(str_: *const libc::c_char, ...) -> libc::c_int;
    pub fn flint_sscanf(s: *const libc::c_char, str_: *const libc::c_char, ...) -> libc::c_int;
    pub fn flint_fprintf(f: *mut FILE, str_: *const libc::c_char, ...) -> libc::c_int;
    pub fn flint_fscanf(f: *mut FILE, str_: *const libc::c_char, ...) -> libc::c_int;
    pub fn flint_throw(exc: flint_err_t, msg: *const libc::c_char, ...);
}