-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutils.h
31 lines (28 loc) · 877 Bytes
/
utils.h
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
#pragma once
namespace std {
template<bool Condition, class TrueType, class FalseType>
struct conditional { typedef TrueType type; };
template<class TrueType, class FalseType>
struct conditional<false, TrueType, FalseType> { typedef FalseType type; };
template<bool Condition, class TrueType>
struct enable_if {};
template<class TrueType>
struct enable_if<true, TrueType> { typedef TrueType type; };
}
namespace Nixie {
template <uint8_t TUBES>
using uint_for_tubes =
typename std::conditional<
TUBES <= 2,
uint8_t,
typename std::conditional<
TUBES <= 4,
uint16_t,
typename std::conditional<
TUBES <= 9,
uint32_t,
typename std::enable_if<TUBES<=19, uint64_t>::type
>::type
>::type
>::type;
}