SmallestValueType.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #ifndef _Smallest_Value_Type_h_
00042 #define _Smallest_Value_Type_h_
00043
00044 #include <stdint.h>
00045
00046 #include "config/type_traits/SmallestUnsignedTypeSelector.h"
00047 #include "config/type_traits/SmallestSignedTypeSelector.h"
00048
00049 #include "assert/staticerror.h"
00050
00051 namespace famouso {
00052 namespace mw {
00053 namespace attributes {
00054 namespace detail {
00055
00056
00057 template <typename ValueType, ValueType Value>
00058 struct SmallestValueType {
00059 FAMOUSO_STATIC_ASSERT_ERROR(false, type_not_implemented_yet, (ValueType));
00060 };
00061
00062
00063 template <uint64_t Value>
00064 struct SmallestValueType<uint64_t, Value> {
00065 typedef typename SmallestUnsignedTypeSelector<Value>::type type;
00066 };
00067
00068
00069
00070 template <uint8_t Value>
00071 struct SmallestValueType<uint8_t, Value> :
00072 public SmallestValueType<uint64_t, Value> {};
00073
00074 template <uint16_t Value>
00075 struct SmallestValueType<uint16_t, Value> :
00076 public SmallestValueType<uint64_t, Value> {};
00077
00078 template <uint32_t Value>
00079 struct SmallestValueType<uint32_t, Value> :
00080 public SmallestValueType<uint64_t, Value> {};
00081
00082 template <bool Value>
00083 struct SmallestValueType<bool, Value> :
00084 public SmallestValueType<uint64_t, Value> {};
00085
00086
00087
00088
00089 template <int64_t Value>
00090 struct SmallestValueType<int64_t, Value> :
00091 public SmallestSignedTypeSelector<Value> {};
00092
00093 template <int8_t Value>
00094 struct SmallestValueType<int8_t, Value> :
00095 public SmallestSignedTypeSelector<Value> {};
00096
00097 template <int16_t Value>
00098 struct SmallestValueType<int16_t, Value> :
00099 public SmallestSignedTypeSelector<Value> {};
00100
00101 template <int32_t Value>
00102 struct SmallestValueType<int32_t, Value> :
00103 public SmallestSignedTypeSelector<Value> {};
00104
00105 }
00106 }
00107 }
00108 }
00109
00110 #endif // _Smallest_Value_Type_h_