SMTStabilizer API
Public API documentation for SMTStabilizer
Loading...
Searching...
No Matches
gmp_utils.h
Go to the documentation of this file.
1/***
2 * Bitwuzla: Satisfiability Modulo Theories (SMT) solver.
3 *
4 * Copyright (C) 2025 by the authors listed in the AUTHORS file at
5 * https://github.com/bitwuzla/bitwuzla/blob/main/AUTHORS
6 *
7 * This file is part of Bitwuzla under the MIT license. See COPYING for more
8 * information at https://github.com/bitwuzla/bitwuzla/blob/main/COPYING
9 */
10// Modified by Xiang Zhang, 2026
11// Additional changes licensed under the MIT License
12#ifndef BZLA_UTIL_GMP_UTILS_H_INCLUDED
13#define BZLA_UTIL_GMP_UTILS_H_INCLUDED
14
15#include <gmpxx.h>
16
17#include <cstdint>
18
19namespace stabilizer::util {
20
21// GMP wrapper functions to properly handle case where unsigned long is 32 bit
22// (Windows builds).
23
25void mpz_set_ull(mpz_t rop, uint64_t op);
26
36uint64_t mpz_get_ull(const mpz_t op);
37
39void mpz_init_set_ull(mpz_t rop, uint64_t op);
40
42mpz_class uint64_to_mpz_class(uint64_t op);
43
45void mpz_init_set_sll(mpz_t rop, int64_t op);
46
53size_t mpz_hash(const mpz_t op, uint64_t start = 0);
54
55// These functions only guard their *_ui counterparts with an assertion for the
56// Windows 32-bit case. In the cases where these functions are used we should
57// never use values that require more than 32 bit.
58void mpz_fdiv_q_2exp_ull(mpz_t q, const mpz_t n, uint64_t b);
59
60void mpz_fdiv_r_2exp_ull(mpz_t r, const mpz_t n, uint64_t b);
61
62void mpz_mul_2exp_ull(mpz_t rop, const mpz_t op1, uint64_t op2);
63
64} // namespace stabilizer::util
65
66#endif
mpz_class uint64_to_mpz_class(uint64_t op)
Definition gmp_utils.cpp:64
void mpz_set_ull(mpz_t rop, uint64_t op)
Definition gmp_utils.cpp:22
void mpz_fdiv_r_2exp_ull(mpz_t r, const mpz_t n, uint64_t b)
void mpz_init_set_sll(mpz_t rop, int64_t op)
Definition gmp_utils.cpp:72
void mpz_fdiv_q_2exp_ull(mpz_t q, const mpz_t n, uint64_t b)
uint64_t mpz_get_ull(const mpz_t op)
Definition gmp_utils.cpp:35
void mpz_init_set_ull(mpz_t rop, uint64_t op)
Definition gmp_utils.cpp:50
size_t mpz_hash(const mpz_t op, uint64_t start)
Definition gmp_utils.cpp:86
void mpz_mul_2exp_ull(mpz_t rop, const mpz_t op1, uint64_t op2)