mirror of
https://github.com/Nezumi-2711/winrar-keygen.git
synced 2026-09-22 13:48:33 +00:00
🐧 Cross-platform build support
This commit is contained in:
+19
-2
@@ -1,7 +1,24 @@
|
||||
#pragma once
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4146 4244 4267)
|
||||
#endif
|
||||
#include <gmp.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
// MPIR (used by vcpkg x86/x64) provides mpz_*_sx/mpz_*_ux for intmax_t.
|
||||
// Standard GMP (used by ARM64 and Linux/macOS) does not; fall back to long variants.
|
||||
#ifndef __MPIR_VERSION
|
||||
#define mpz_init_set_sx(z, v) mpz_init_set_si((z), static_cast<long>(v))
|
||||
#define mpz_init_set_ux(z, v) mpz_init_set_ui((z), static_cast<unsigned long>(v))
|
||||
#define mpz_set_sx(z, v) mpz_set_si((z), static_cast<long>(v))
|
||||
#define mpz_set_ux(z, v) mpz_set_ui((z), static_cast<unsigned long>(v))
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
@@ -300,11 +317,11 @@ public:
|
||||
}
|
||||
|
||||
bool TestBit(size_t i) const noexcept {
|
||||
return mpz_tstbit(_Value, i) != 0;
|
||||
return mpz_tstbit(_Value, static_cast<mp_bitcnt_t>(i)) != 0;
|
||||
}
|
||||
|
||||
void SetBit(size_t i) noexcept {
|
||||
mpz_setbit(_Value, i);
|
||||
mpz_setbit(_Value, static_cast<mp_bitcnt_t>(i));
|
||||
}
|
||||
|
||||
std::string ToString(size_t Base, bool LowerCase) const {
|
||||
|
||||
Reference in New Issue
Block a user