1 /*
2  * Copyright (c) 2016-2018, NVIDIA CORPORATION.  All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 /** \file
18  * \brief Legacy integer type
19  *
20  *  Some legacy types from scutil.h.
21  */
22 
23 #ifndef LEGACY_INTS_H_
24 #define LEGACY_INTS_H_
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #include <stdint.h>
30 
31 typedef int INT;	/* native integer at least 32 bits */
32 typedef unsigned UINT;	/* unsigned 32 bit native integer */
33 typedef void VOID;
34 
35 /* BIGINT is a mess.  It's defined as INT on many 32-bit targets,
36  * despite comments that read "native integer at least 64 bits"
37  * (as if things would still work if 128-bit integers were used).
38  * Defining it as int64_t seems like a good idea but it leads to warnings
39  * in nonportable code that really expects long.
40  */
41 typedef long BIGINT;		/* native integer "at least 64 bits" */
42 typedef unsigned long BIGUINT;	/* native unsigned integer "at least 64 bits" */
43 
44 typedef int64_t BIGINT64;	/* 64-bit native integer */
45 typedef uint64_t BIGUINT64;	/* 64-bit native unsigned integer */
46 typedef uint64_t BITMASK64;	/* native 64-bit unsigned int */
47 
48 typedef int32_t DBLINT64[2];	/* signed 64-bit 2's complement integer: [0]
49 				 * - most significant 32 bits, including sign
50 				 * [1] - least significant 32 bits */
51 typedef uint32_t DBLUINT64[2];	/* unsigned 64-bit integer: [0] - most
52 				 * significant 32 bits [1] - least
53 				 * significant 32 bits */
54 
55 void bgitoi64(int64_t x, DBLINT64 res);
56 int64_t i64tobgi(DBLINT64 x);
57 
58 #define BIGIPFSZ "l" /* used to define ISZ_PF */
59 
60 #ifdef __cplusplus
61 }
62 #endif
63 #endif /* LEGACY_INTS_H_ */
64