aboutsummaryrefslogtreecommitdiff
path: root/libk/types.h
diff options
context:
space:
mode:
Diffstat (limited to 'libk/types.h')
-rw-r--r--libk/types.h29
1 files changed, 19 insertions, 10 deletions
diff --git a/libk/types.h b/libk/types.h
index 4c50a35..7f16206 100644
--- a/libk/types.h
+++ b/libk/types.h
@@ -4,27 +4,36 @@ typedef unsigned short size_t;
typedef int ssize_t;
typedef unsigned char uint8_t;
+constexpr uint8_t uint8_t_min = 0;
+constexpr uint8_t uint8_t_max = 0xff;
typedef unsigned short uint16_t;
constexpr uint16_t uint16_t_min = 0;
constexpr uint16_t uint16_t_max = 0xffff;
typedef unsigned int uint32_t;
-typedef unsigned long long int uint64_t;
+constexpr uint32_t uint32_t_min = 0;
+constexpr uint32_t uint32_t_max = 0xffffffff;
+
+typedef unsigned long long uint64_t;
+constexpr uint64_t uint64_t_min = 0;
+constexpr uint64_t uint64_t_max = 0xffffffffffffffff;
typedef char int8_t;
+constexpr int8_t int8_t_max = uint8_t_max / 2;
+constexpr int8_t int8_t_min = -int8_t_max - 1;
+
typedef short int16_t;
+constexpr int16_t int16_t_max = uint16_t_max / 2;
+constexpr int16_t int16_t_min = -int16_t_max - 1;
+
typedef int int32_t;
-typedef long long int int64_t;
+constexpr int32_t int32_t_max = uint32_t_max / 2;
+constexpr int32_t int32_t_min = -int32_t_max - 1;
-/* in x86:
- * byte: 1 byte, 8 bits
- * word: 2 bytes, 16 bits
- * dword: 4 bytes, 32 bits
- * qword: 8 bytes, 64 bits
- * */
-typedef uint16_t uword_t;
-typedef int16_t word_t;
+typedef long long int int64_t;
+constexpr int64_t int64_t_max = uint64_t_max / 2;
+constexpr int64_t int64_t_min = -int64_t_max - 1;
// Type Traits