Compare commits
4 Commits
045363c733
...
sandbox/sm
| Author | SHA1 | Date | |
|---|---|---|---|
| 1c46307798 | |||
| b7159c3606 | |||
| 2be63fda5a | |||
| 036b17fca9 |
@@ -66,15 +66,12 @@ constexpr inline void format_arg(char* dest, const char* arg) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// End of recursion
|
|
||||||
template <auto ast>
|
|
||||||
constexpr inline void format_args(char*) {
|
|
||||||
}
|
|
||||||
|
|
||||||
template <auto fmt_data_array, typename first_arg_t, typename... args_t>
|
template <auto fmt_data_array, typename first_arg_t, typename... args_t>
|
||||||
constexpr inline void format_args(char* dest, first_arg_t first_arg,
|
constexpr inline void format_args(char* dest, first_arg_t first_arg,
|
||||||
args_t... args) {
|
args_t... args) {
|
||||||
format_arg<fmt_data_array[0]>(dest + fmt_data_array[0].position, first_arg);
|
format_arg<fmt_data_array[0]>(dest + fmt_data_array[0].position, first_arg);
|
||||||
|
|
||||||
|
if constexpr(fmt_data_array.size() > 1)
|
||||||
format_args<drop_first(fmt_data_array)>(dest, args...);
|
format_args<drop_first(fmt_data_array)>(dest, args...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,9 @@ inline int do_count_digits_decimal(uint64_t n) {
|
|||||||
6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10,
|
6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10,
|
||||||
10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 15,
|
10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 15,
|
||||||
15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 19, 20};
|
15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 19, 20};
|
||||||
|
|
||||||
auto t = bsr2log10[__builtin_clzll(n | 1) ^ 63];
|
auto t = bsr2log10[__builtin_clzll(n | 1) ^ 63];
|
||||||
|
|
||||||
static constexpr const uint64_t zero_or_powers_of_10[] = {
|
static constexpr const uint64_t zero_or_powers_of_10[] = {
|
||||||
0, 0, FMT_POWERS_OF_10(1U), FMT_POWERS_OF_10(1000000000ULL),
|
0, 0, FMT_POWERS_OF_10(1U), FMT_POWERS_OF_10(1000000000ULL),
|
||||||
10000000000000000000ULL};
|
10000000000000000000ULL};
|
||||||
@@ -80,9 +82,9 @@ constexpr inline auto count_digits_base(uint64_t n) -> int {
|
|||||||
|
|
||||||
return (result + count_digits_base<FormatType::b>(n));
|
return (result + count_digits_base<FormatType::b>(n));
|
||||||
} else {
|
} else {
|
||||||
if (!std::is_constant_evaluated()) {
|
// if (!std::is_constant_evaluated()) {
|
||||||
return do_count_digits_decimal(n);
|
// return do_count_digits_decimal(n);
|
||||||
}
|
// }
|
||||||
return count_digits_decimal_fallback(n);
|
return count_digits_decimal_fallback(n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -187,7 +187,8 @@ concept floating_point = is_floating_point_v<type_t>;
|
|||||||
|
|
||||||
|
|
||||||
template <typename input_t, typename output_t>
|
template <typename input_t, typename output_t>
|
||||||
constexpr inline void copy(const input_t* start, const input_t* end, output_t* dest_start) {
|
constexpr inline void copy(const input_t* start, const input_t* end,
|
||||||
|
output_t* dest_start) {
|
||||||
auto temp = start;
|
auto temp = start;
|
||||||
while (temp != end)
|
while (temp != end)
|
||||||
*(dest_start++) = *(temp++);
|
*(dest_start++) = *(temp++);
|
||||||
@@ -250,6 +251,9 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr std::size_t size() const noexcept {
|
||||||
|
return t_size;
|
||||||
|
}
|
||||||
|
|
||||||
constexpr data_t& operator[](std::size_t index) noexcept {
|
constexpr data_t& operator[](std::size_t index) noexcept {
|
||||||
return m_data[index];
|
return m_data[index];
|
||||||
|
|||||||
Reference in New Issue
Block a user