Skip to content

Commit

Permalink
add *_MIN *_MAX defines for system has no stdint.h
Browse files Browse the repository at this point in the history
  • Loading branch information
tandasat committed Apr 23, 2016
1 parent 1dd8987 commit 59cbe18
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion include/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// stdbool.h
#if (_MSC_VER < 1800) || defined(_KERNEL_MODE)
// this system does not have inttypes.h
// this system does not have stdbool.h
#ifndef __cplusplus
typedef unsigned char bool;
#define false 0
Expand All @@ -33,6 +33,7 @@ typedef unsigned char bool;
// this system does not have inttypes.h

#if defined(_MSC_VER) && (_MSC_VER <= 1700 || defined(_KERNEL_MODE))
// this system does not have stdint.h
typedef signed char int8_t;
typedef signed short int16_t;
typedef signed int int32_t;
Expand All @@ -41,6 +42,19 @@ typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef signed long long int64_t;
typedef unsigned long long uint64_t;

#define INT8_MIN (-127i8 - 1)
#define INT16_MIN (-32767i16 - 1)
#define INT32_MIN (-2147483647i32 - 1)
#define INT64_MIN (-9223372036854775807i64 - 1)
#define INT8_MAX 127i8
#define INT16_MAX 32767i16
#define INT32_MAX 2147483647i32
#define INT64_MAX 9223372036854775807i64
#define UINT8_MAX 0xffui8
#define UINT16_MAX 0xffffui16
#define UINT32_MAX 0xffffffffui32
#define UINT64_MAX 0xffffffffffffffffui64
#endif

#define __PRI_8_LENGTH_MODIFIER__ "hh"
Expand Down

0 comments on commit 59cbe18

Please sign in to comment.