Leonardus
Loading...
Searching...
No Matches
algo.h
Go to the documentation of this file.
1
17#pragma once
18
19// Inc Library
20#include <string>
21#include <cstdint>
22#include <gmp.h>
23
24
26namespace algo {
27
39 __int128 xgcd( __int128 p_a, __int128 p_b, __int128 * p_s, __int128 * p_t );
40
41
46 bool isint128( const std::string & p_str );
47
48
53 bool isint128( const mpz_t p_x );
54
55
61 bool isfloat128( const std::string & p_str );
62
63
68 int32_t rand( uint32_t * p_seed );
69
70
78 inline __int128 mmod( __int128 p_d, __int128 p_m ) {
79 const __int128 rem = p_d % p_m;
80 return rem>=0 ? rem : rem+p_m;
81 }
82
83} // namespace algo
Collection of numeric algorithms.
Definition algo.h:26
int32_t rand(uint32_t *p_seed)
ISO C rand_r() for 32 bit.
Definition algo.cpp:150
bool isfloat128(const std::string &p_str)
Is the string a 128 bit float.
Definition algo.cpp:113
__int128 mmod(__int128 p_d, __int128 p_m)
Mathematical modulus.
Definition algo.h:78
bool isint128(const std::string &p_str)
Is the string a 128 bit integer.
Definition algo.cpp:73
__int128 xgcd(__int128 p_a, __int128 p_b, __int128 *p_s, __int128 *p_t)
Extended Euclidean algorithm.
Definition algo.cpp:33