-
Notifications
You must be signed in to change notification settings - Fork 0
/
stdint128.h
91 lines (85 loc) · 2.47 KB
/
stdint128.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/**
* This file is a part of the UMSKT Project
*
* Copyleft (C) 2019-2024 UMSKT Contributors (et.al.)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*
* @FileCreated by Neo on 02/19/2024
* @Maintainer Neo
*/
#ifndef __STDINT128__
#define __STDINT128__
// check the results of FIND_INT128_TYPES()
#ifndef HAVE_INT128BUILTIN
#define HAVE_INT128BUILTIN
#endif
#if !defined(HAVEuint128_t)
#if defined(HAVEuint128_as_u_long_long)
typedef unsigned long long uint128_t;
#elif defined(HAVE__uint128_t)
typedef __uint128_t uint128_t;
#elif defined(HAVE__uint128)
typedef __uint128 uint128_t;
#elif defined(HAVEuint128)
typedef uint128 uint128_t;
#elif defined(HAVEunsigned__int128_t)
typedef unsigned __int128_t uint128_t;
#elif defined(HAVEunsignedint128_t)
typedef unsigned int128_t uint128_t;
#elif defined(HAVEunsigned__int128)
typedef unsigned __int128 uint128_t
#elif defined(HAVEunsignedint128)
typedef unsigned int128 uint128_t;
#else
#ifdef HAVE_INT128BUILTIN
#undef HAVE_INT128BUILTIN
#endif
//#if defined(_MSC_VER)
//#include <intrin.h>
//#endif
#include <stdint.h>
typedef struct uint128_t {
uint64_t hi;
uint64_t lo;
};
#endif
#endif // !defined(HAVEuint128_t)
#ifndef HAVE_UINT128BUILTIN
#define HAVE_UINT128BUILTIN
#endif
#if !defined(HAVEint128_t)
#if defined(HAVE__int128_t)
typedef __int128_t int128_t;
#elif defined(HAVEint128_as_long_long)
typedef long long int128_t;
#elif defined(HAVE__int128)
typedef __int128 int128_t;
#elif defined(HAVEint128)
typedef int128 int128_t;
#else
#ifdef HAVE_UINT128BUILTIN
#undef HAVE_UINT128BUILTIN
#endif
//#if defined(_MSC_VER)
//#include <intrin.h>
//#endif
#include <stdint.h>
typedef struct int128_t {
int64_t hi;
int64_t lo;
};
#endif
#endif // !defined(HAVEint128_t)
#endif // ifdef __STDINT128__