Skip to main content

flint_sys/
flint.rs

1/* automatically generated by rust-bindgen 0.70.1 */
2
3use libc::*;
4use crate::deps::*;
5
6
7pub const FLINT_HAVE_VA_LIST: u32 = 1;
8pub const FLINT_HAVE_FILE: u32 = 1;
9pub const __FLINT_VERSION: u32 = 3;
10pub const __FLINT_VERSION_MINOR: u32 = 5;
11pub const __FLINT_VERSION_PATCHLEVEL: u32 = 0;
12#[allow(unsafe_code)]
13pub const FLINT_VERSION: &::std::ffi::CStr =
14    unsafe { ::std::ffi::CStr::from_bytes_with_nul_unchecked(b"3.5.0\0") };
15#[allow(unsafe_code)]
16pub const _WORD_FMT: &::std::ffi::CStr =
17    unsafe { ::std::ffi::CStr::from_bytes_with_nul_unchecked(b"l\0") };
18#[allow(unsafe_code)]
19pub const WORD_FMT: &::std::ffi::CStr =
20    unsafe { ::std::ffi::CStr::from_bytes_with_nul_unchecked(b"%l\0") };
21#[allow(unsafe_code)]
22pub const WORD_WIDTH_FMT: &::std::ffi::CStr =
23    unsafe { ::std::ffi::CStr::from_bytes_with_nul_unchecked(b"%*l\0") };
24pub const FLINT_D_BITS: u32 = 53;
25pub const FLINT64: u32 = 1;
26pub const SMALL_FMPZ_BITCOUNT_MAX: u32 = 62;
27pub const MPZ_MIN_ALLOC: u32 = 2;
28#[repr(C)]
29#[derive(Debug, Copy, Clone)]
30pub struct __FLINT_FILE {
31    _unused: [u8; 0],
32}
33pub type FLINT_FILE = __FLINT_FILE;
34pub type flint_bitcnt_t = ulong;
35pub type nn_ptr = *mut ulong;
36pub type nn_srcptr = *const ulong;
37pub type flint_cleanup_function_t = ::std::option::Option<unsafe extern "C" fn()>;
38pub type thread_pool_handle = libc::c_int;
39#[repr(C)]
40pub struct flint_rand_struct {
41    pub __gmp_state: *mut libc::c_void,
42    pub __randval: ulong,
43    pub __randval2: ulong,
44}
45#[allow(clippy::unnecessary_operation, clippy::identity_op)]
46const _: () = {
47    ["Size of flint_rand_struct"][::std::mem::size_of::<flint_rand_struct>() - 24usize];
48    ["Alignment of flint_rand_struct"][::std::mem::align_of::<flint_rand_struct>() - 8usize];
49    ["Offset of field: flint_rand_struct::__gmp_state"]
50        [::std::mem::offset_of!(flint_rand_struct, __gmp_state) - 0usize];
51    ["Offset of field: flint_rand_struct::__randval"]
52        [::std::mem::offset_of!(flint_rand_struct, __randval) - 8usize];
53    ["Offset of field: flint_rand_struct::__randval2"]
54        [::std::mem::offset_of!(flint_rand_struct, __randval2) - 16usize];
55};
56impl Default for flint_rand_struct {
57    fn default() -> Self {
58        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
59        unsafe {
60            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
61            s.assume_init()
62        }
63    }
64}
65pub type flint_rand_t = [flint_rand_struct; 1usize];
66pub const flint_err_t_FLINT_ERROR: flint_err_t = 0;
67pub const flint_err_t_FLINT_OVERFLOW: flint_err_t = 1;
68pub const flint_err_t_FLINT_IMPINV: flint_err_t = 2;
69pub const flint_err_t_FLINT_DOMERR: flint_err_t = 3;
70pub const flint_err_t_FLINT_DIVZERO: flint_err_t = 4;
71pub const flint_err_t_FLINT_EXPOF: flint_err_t = 5;
72pub const flint_err_t_FLINT_INEXACT: flint_err_t = 6;
73pub const flint_err_t_FLINT_TEST_FAIL: flint_err_t = 7;
74pub type flint_err_t = libc::c_uint;
75#[repr(C)]
76pub struct nmod_t {
77    pub n: ulong,
78    pub ninv: ulong,
79    pub norm: flint_bitcnt_t,
80}
81#[allow(clippy::unnecessary_operation, clippy::identity_op)]
82const _: () = {
83    ["Size of nmod_t"][::std::mem::size_of::<nmod_t>() - 24usize];
84    ["Alignment of nmod_t"][::std::mem::align_of::<nmod_t>() - 8usize];
85    ["Offset of field: nmod_t::n"][::std::mem::offset_of!(nmod_t, n) - 0usize];
86    ["Offset of field: nmod_t::ninv"][::std::mem::offset_of!(nmod_t, ninv) - 8usize];
87    ["Offset of field: nmod_t::norm"][::std::mem::offset_of!(nmod_t, norm) - 16usize];
88};
89impl Default for nmod_t {
90    fn default() -> Self {
91        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
92        unsafe {
93            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
94            s.assume_init()
95        }
96    }
97}
98pub type fmpz = slong;
99pub type fmpz_t = [fmpz; 1usize];
100#[repr(C)]
101pub struct fmpq {
102    pub num: fmpz,
103    pub den: fmpz,
104}
105#[allow(clippy::unnecessary_operation, clippy::identity_op)]
106const _: () = {
107    ["Size of fmpq"][::std::mem::size_of::<fmpq>() - 16usize];
108    ["Alignment of fmpq"][::std::mem::align_of::<fmpq>() - 8usize];
109    ["Offset of field: fmpq::num"][::std::mem::offset_of!(fmpq, num) - 0usize];
110    ["Offset of field: fmpq::den"][::std::mem::offset_of!(fmpq, den) - 8usize];
111};
112impl Default for fmpq {
113    fn default() -> Self {
114        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
115        unsafe {
116            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
117            s.assume_init()
118        }
119    }
120}
121pub type fmpq_t = [fmpq; 1usize];
122extern "C" {
123    pub static mut flint_version: [libc::c_char; 0usize];
124    pub fn flint_malloc(size: usize) -> *mut libc::c_void;
125    pub fn flint_realloc(ptr: *mut libc::c_void, size: usize) -> *mut libc::c_void;
126    pub fn flint_calloc(num: usize, size: usize) -> *mut libc::c_void;
127    pub fn flint_free(ptr: *mut libc::c_void);
128    pub fn flint_aligned_alloc(alignment: usize, size: usize) -> *mut libc::c_void;
129    pub fn flint_aligned_free(ptr: *mut libc::c_void);
130    pub fn flint_register_cleanup_function(cleanup_function: flint_cleanup_function_t);
131    pub fn flint_cleanup();
132    pub fn flint_cleanup_master();
133    pub fn __flint_set_all_memory_functions(
134        alloc_func: ::std::option::Option<unsafe extern "C" fn(arg1: usize) -> *mut libc::c_void>,
135        calloc_func: ::std::option::Option<
136            unsafe extern "C" fn(arg1: usize, arg2: usize) -> *mut libc::c_void,
137        >,
138        realloc_func: ::std::option::Option<
139            unsafe extern "C" fn(arg1: *mut libc::c_void, arg2: usize) -> *mut libc::c_void,
140        >,
141        free_func: ::std::option::Option<unsafe extern "C" fn(arg1: *mut libc::c_void)>,
142        aligned_alloc_func: ::std::option::Option<
143            unsafe extern "C" fn(arg1: usize, arg2: usize) -> *mut libc::c_void,
144        >,
145        aligned_free_func: ::std::option::Option<unsafe extern "C" fn(arg1: *mut libc::c_void)>,
146    );
147    pub fn __flint_get_all_memory_functions(
148        alloc_func: *mut ::std::option::Option<
149            unsafe extern "C" fn(arg1: usize) -> *mut libc::c_void,
150        >,
151        calloc_func: *mut ::std::option::Option<
152            unsafe extern "C" fn(arg1: usize, arg2: usize) -> *mut libc::c_void,
153        >,
154        realloc_func: *mut ::std::option::Option<
155            unsafe extern "C" fn(arg1: *mut libc::c_void, arg2: usize) -> *mut libc::c_void,
156        >,
157        free_func: *mut ::std::option::Option<unsafe extern "C" fn(arg1: *mut libc::c_void)>,
158        aligned_alloc_func: *mut ::std::option::Option<
159            unsafe extern "C" fn(arg1: usize, arg2: usize) -> *mut libc::c_void,
160        >,
161        aligned_free_func: *mut ::std::option::Option<
162            unsafe extern "C" fn(arg1: *mut libc::c_void),
163        >,
164    );
165    pub fn __flint_set_memory_functions(
166        alloc_func: ::std::option::Option<unsafe extern "C" fn(arg1: usize) -> *mut libc::c_void>,
167        calloc_func: ::std::option::Option<
168            unsafe extern "C" fn(arg1: usize, arg2: usize) -> *mut libc::c_void,
169        >,
170        realloc_func: ::std::option::Option<
171            unsafe extern "C" fn(arg1: *mut libc::c_void, arg2: usize) -> *mut libc::c_void,
172        >,
173        free_func: ::std::option::Option<unsafe extern "C" fn(arg1: *mut libc::c_void)>,
174    );
175    pub fn __flint_get_memory_functions(
176        alloc_func: *mut ::std::option::Option<
177            unsafe extern "C" fn(arg1: usize) -> *mut libc::c_void,
178        >,
179        calloc_func: *mut ::std::option::Option<
180            unsafe extern "C" fn(arg1: usize, arg2: usize) -> *mut libc::c_void,
181        >,
182        realloc_func: *mut ::std::option::Option<
183            unsafe extern "C" fn(arg1: *mut libc::c_void, arg2: usize) -> *mut libc::c_void,
184        >,
185        free_func: *mut ::std::option::Option<unsafe extern "C" fn(arg1: *mut libc::c_void)>,
186    );
187    pub fn flint_abort();
188    pub fn flint_set_abort(func: ::std::option::Option<unsafe extern "C" fn()>);
189    pub fn flint_get_num_threads() -> libc::c_int;
190    pub fn flint_set_num_threads(num_threads: libc::c_int);
191    pub fn _flint_set_num_workers(num_workers: libc::c_int);
192    pub fn flint_set_num_workers(num_workers: libc::c_int) -> libc::c_int;
193    pub fn flint_reset_num_workers(max_workers: libc::c_int);
194    pub fn flint_set_thread_affinity(cpus: *mut libc::c_int, length: slong) -> libc::c_int;
195    pub fn flint_restore_thread_affinity() -> libc::c_int;
196    pub fn flint_test_multiplier() -> f64;
197    #[link_name = "flint_rand_init__extern"]
198    pub fn flint_rand_init(state: *mut flint_rand_struct);
199    #[link_name = "flint_rand_set_seed__extern"]
200    pub fn flint_rand_set_seed(state: *mut flint_rand_struct, seed1: ulong, seed2: ulong);
201    #[link_name = "flint_rand_get_seed__extern"]
202    pub fn flint_rand_get_seed(seed1: *mut ulong, seed2: *mut ulong, state: *mut flint_rand_struct);
203    #[link_name = "flint_rand_clear__extern"]
204    pub fn flint_rand_clear(UNUSED_state: *mut flint_rand_struct);
205    pub fn _flint_rand_init_gmp_state(state: *mut flint_rand_struct);
206    pub fn _flint_rand_clear_gmp_state(state: *mut flint_rand_struct);
207    pub fn flint_randinit(arg1: *mut flint_rand_struct);
208    pub fn flint_randclear(arg1: *mut flint_rand_struct);
209    pub fn flint_randseed(arg1: *mut flint_rand_struct, arg2: ulong, arg3: ulong);
210    pub fn flint_get_randseed(arg1: *mut ulong, arg2: *mut ulong, arg3: *mut flint_rand_struct);
211    pub fn flint_rand_alloc() -> *mut flint_rand_struct;
212    pub fn flint_rand_free(state: *mut flint_rand_struct);
213    pub fn n_randlimb(arg1: *mut flint_rand_struct) -> ulong;
214    pub fn n_randtest(arg1: *mut flint_rand_struct) -> ulong;
215    pub fn n_randtest_not_zero(arg1: *mut flint_rand_struct) -> ulong;
216    pub fn n_randint(state: *mut flint_rand_struct, limit: ulong) -> ulong;
217    pub fn flint_merge_sort(
218        buf: *mut libc::c_void,
219        len: slong,
220        size: slong,
221        cmp: ::std::option::Option<
222            unsafe extern "C" fn(
223                arg1: *const libc::c_void,
224                arg2: *const libc::c_void,
225                arg3: *mut libc::c_void,
226            ) -> libc::c_int,
227        >,
228        data: *mut libc::c_void,
229    );
230    pub fn flint_sort(
231        buf: *mut libc::c_void,
232        len: slong,
233        size: slong,
234        cmp: ::std::option::Option<
235            unsafe extern "C" fn(
236                arg1: *const libc::c_void,
237                arg2: *const libc::c_void,
238                arg3: *mut libc::c_void,
239            ) -> libc::c_int,
240        >,
241        data: *mut libc::c_void,
242    );
243    pub fn parse_fmt(floating: *mut libc::c_int, fmt: *const libc::c_char) -> libc::c_int;
244    pub fn flint_printf(str_: *const libc::c_char, ...) -> libc::c_int;
245    pub fn flint_sprintf(s: *mut libc::c_char, str_: *const libc::c_char, ...) -> libc::c_int;
246    pub fn flint_snprintf(
247        s: *mut libc::c_char,
248        n: usize,
249        str_: *const libc::c_char,
250        ...
251    ) -> libc::c_int;
252    pub fn flint_scanf(str_: *const libc::c_char, ...) -> libc::c_int;
253    pub fn flint_sscanf(s: *const libc::c_char, str_: *const libc::c_char, ...) -> libc::c_int;
254    pub fn flint_fprintf(f: *mut FILE, str_: *const libc::c_char, ...) -> libc::c_int;
255    pub fn flint_fscanf(f: *mut FILE, str_: *const libc::c_char, ...) -> libc::c_int;
256    pub fn flint_throw(exc: flint_err_t, msg: *const libc::c_char, ...);
257}