aboutsummaryrefslogtreecommitdiff
path: root/libk/types.h
blob: 4018ab8f9fc65b556bc978097428fa8a16a264e9 (plain)
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
#pragma once

typedef unsigned short size_t;
typedef int ssize_t;

typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long int uint64_t;

typedef char int8_t;
typedef short int16_t;
typedef int int32_t;
typedef long long int int64_t;

// Type Traits

template <class T, T v>
struct integral_constant {
  constexpr T operator()() const { return v; }
  constexpr operator T() const { return v; }
};

/* is_same */
template <class T, class U>
struct is_same : integral_constant<bool, false> {};

template <class T>
struct is_same<T, T> : integral_constant<bool, true> {};

/* is_unsigned */
template <typename T>
struct is_unsigned : integral_constant<bool, (T{0} < static_cast<T>(-1))> {};