-
Notifications
You must be signed in to change notification settings - Fork 10
/
bigdtypes.h
71 lines (64 loc) · 1.89 KB
/
bigdtypes.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
/* $Id: bigdtypes.h $ */
/***** BEGIN LICENSE BLOCK *****
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright (c) 2001-16 David Ireland, D.I. Management Services Pty Limited
* <http://www.di-mgt.com.au/bigdigits.html>. All rights reserved.
*
***** END LICENSE BLOCK *****/
/*
* Last updated:
* $Date: 2016-03-31 09:51:00 $
* $Revision: 2.6.1 $
* $Author: dai $
*/
#ifndef BIGDTYPES_H_
#define BIGDTYPES_H_ 1
#include <cstddef>
/*
The following PP instructions assume that all Linux systems have a C99-conforming
<cstdint>; that other Unix systems have the uint32_t definitions in <sys/types.h>;
and that MS et al don't have them at all. This version assumes that a long is 32 bits.
Adjust if necessary to suit your system.
You can override by defining HAVE_C99INCLUDES or HAVE_SYS_TYPES.
*/
#ifndef EXACT_INTS_DEFINED_
#define EXACT_INTS_DEFINED_ 1
#ifndef HAVE_C99INCLUDES
#if (__STDC_VERSION >= 199901L) || defined(linux) || defined(__linux__) || defined(__APPLE__)
#define HAVE_C99INCLUDES
#endif
#endif
#ifndef HAVE_SYS_TYPES
#if defined(unix) || defined(__unix__)
#define HAVE_SYS_TYPES
#endif
#endif
#ifdef HAVE_C99INCLUDES
#include <cstdint>
#elif defined(HAVE_SYS_TYPES)
#include <sys/types.h>
#else
#define uint32_t unsigned long
#define uint16_t unsigned short
#define uint8_t unsigned char
#endif /* HAVE_C99INCLUDES */
#endif /* EXACT_INTS_DEFINED_ */
/* Macros for format specifiers
-- change to "u", "x" and "X" if necessary */
#ifdef HAVE_C99INCLUDES
#include <cinttypes>
#else
#define PRIu32 "lu"
#define PRIx32 "lx"
#define PRIX32 "lX"
#endif
/* We define our own
-- Example: ``printf("%" PRIxBIGD "\n", d);`` */
#define PRIuBIGD PRIu32
#define PRIxBIGD PRIx32
#define PRIXBIGD PRIX32
#endif /* BIGDTYPES_H_ */