File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -28,11 +28,20 @@ template <typename UC> fastfloat_really_inline constexpr bool has_simd_opt() {
28
28
#endif
29
29
}
30
30
31
+ template <typename value_type> struct get_equal_sized_uint {
32
+ using type = std::conditional_t <
33
+ sizeof (value_type) == 4 , uint32_t ,
34
+ std::conditional_t <sizeof (value_type) == 2 , uint16_t , uint8_t >>;
35
+ };
36
+
37
+ template <typename value_type>
38
+ using get_equal_sized_uint_t = typename get_equal_sized_uint<value_type>::type;
39
+
31
40
// Next function can be micro-optimized, but compilers are entirely
32
41
// able to optimize it well.
33
42
template <typename UC>
34
43
fastfloat_really_inline constexpr bool is_integer (UC c) noexcept {
35
- return static_cast <uint8_t >(c - UC (' 0' )) < 10 ;
44
+ return static_cast <get_equal_sized_uint_t <UC> >(c - UC (' 0' )) < 10 ;
36
45
}
37
46
38
47
fastfloat_really_inline constexpr uint64_t byteswap (uint64_t val) {
You can’t perform that action at this time.
0 commit comments