Skip to content

Commit 8d14a9f

Browse files
committed
Fix integer type selection ifdef
Fix proposed by @npatil2 Additionally inverted if/else construct to simplify condition. Resolves #23
1 parent 273e26a commit 8d14a9f

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

include/Zycore/Types.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,9 @@
3838
/* Integer types */
3939
/* ============================================================================================== */
4040

41-
#if !defined(ZYAN_NO_LIBC) && \
42-
(!defined(ZYAN_MSVC) && defined(ZYAN_KERNEL)) // The WDK LibC lacks stdint.h.
43-
// If is LibC present, we use stdint types.
44-
# include <stdint.h>
45-
# include <stddef.h>
46-
typedef uint8_t ZyanU8;
47-
typedef uint16_t ZyanU16;
48-
typedef uint32_t ZyanU32;
49-
typedef uint64_t ZyanU64;
50-
typedef int8_t ZyanI8;
51-
typedef int16_t ZyanI16;
52-
typedef int32_t ZyanI32;
53-
typedef int64_t ZyanI64;
54-
typedef size_t ZyanUSize;
55-
typedef ptrdiff_t ZyanISize;
56-
typedef uintptr_t ZyanUPointer;
57-
typedef intptr_t ZyanIPointer;
58-
#else
59-
// No LibC, use compiler built-in types / macros.
41+
#if defined(ZYAN_NO_LIBC) || \
42+
(defined(ZYAN_MSVC) && defined(ZYAN_KERNEL)) // The WDK LibC lacks stdint.h.
43+
// No LibC mode, use compiler built-in types / macros.
6044
# if defined(ZYAN_MSVC) || defined(ZYAN_ICC)
6145
typedef unsigned __int8 ZyanU8;
6246
typedef unsigned __int16 ZyanU16;
@@ -93,6 +77,22 @@
9377
# else
9478
# error "Unsupported compiler for no-libc mode."
9579
# endif
80+
#else
81+
// If is LibC present, we use stdint types.
82+
# include <stdint.h>
83+
# include <stddef.h>
84+
typedef uint8_t ZyanU8;
85+
typedef uint16_t ZyanU16;
86+
typedef uint32_t ZyanU32;
87+
typedef uint64_t ZyanU64;
88+
typedef int8_t ZyanI8;
89+
typedef int16_t ZyanI16;
90+
typedef int32_t ZyanI32;
91+
typedef int64_t ZyanI64;
92+
typedef size_t ZyanUSize;
93+
typedef ptrdiff_t ZyanISize;
94+
typedef uintptr_t ZyanUPointer;
95+
typedef intptr_t ZyanIPointer;
9696
#endif
9797

9898
// Verify size assumptions.
@@ -144,7 +144,7 @@ typedef const void* ZyanConstVoidPointer;
144144

145145
/**
146146
* @brief Defines the `ZyanBool` data-type.
147-
*
147+
*
148148
* Represents a default boolean data-type where `0` is interpreted as `false` and all other values
149149
* as `true`.
150150
*/
@@ -156,8 +156,8 @@ typedef ZyanU8 ZyanBool;
156156

157157
/**
158158
* @brief Defines the `ZyanTernary` data-type.
159-
*
160-
* The `ZyanTernary` is a balanced ternary type that uses three truth values indicating `true`,
159+
*
160+
* The `ZyanTernary` is a balanced ternary type that uses three truth values indicating `true`,
161161
* `false` and an indeterminate third value.
162162
*/
163163
typedef ZyanI8 ZyanTernary;
@@ -176,7 +176,7 @@ typedef ZyanI8 ZyanTernary;
176176

177177
/**
178178
* @brief Defines the `ZyanCharPointer` data-type.
179-
*
179+
*
180180
* This type is most often used to represent null-terminated strings aka. C-style strings.
181181
*/
182182
typedef char* ZyanCharPointer;

0 commit comments

Comments
 (0)