Skip to content

Commit 54270bc

Browse files
committed
change enable_if_t strategy
1 parent dc831a9 commit 54270bc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

libc/src/__support/integer_to_string.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,9 @@ template <size_t radix> using Custom = details::Fmt<radix>;
169169
// by reference, and modified by dividing by 10, so that iterating this
170170
// function extracts all the digits of the original number one at a time from
171171
// low to high.
172-
template <typename T, cpp::enable_if_t<cpp::is_integral_v<T>, int> = 0>
173-
LIBC_INLINE uint8_t extract_decimal_digit(T &value) {
172+
template <typename T>
173+
LIBC_INLINE cpp::enable_if_t<cpp::is_integral_v<T>, uint8_t>
174+
extract_decimal_digit(T &value) {
174175
const uint8_t digit(static_cast<uint8_t>(value % 10));
175176
// For built-in integer types, we assume that an adequately fast division is
176177
// available. If hardware division isn't implemented, then with a divisor
@@ -182,8 +183,9 @@ LIBC_INLINE uint8_t extract_decimal_digit(T &value) {
182183

183184
// A specialization of extract_decimal_digit for the BigInt type in big_int.h,
184185
// avoiding the use of general-purpose BigInt division which is very slow.
185-
template <typename T, cpp::enable_if_t<is_big_int_v<T>, int> = 0>
186-
LIBC_INLINE uint8_t extract_decimal_digit(T &value) {
186+
template <typename T>
187+
LIBC_INLINE cpp::enable_if_t<is_big_int_v<T>, uint8_t>
188+
extract_decimal_digit(T &value) {
187189
// There are two essential ways you can turn n into (n/10,n%10). One is
188190
// ordinary integer division. The other is a modular-arithmetic approach in
189191
// which you first compute n%10 by bit twiddling, then subtract it off to get

0 commit comments

Comments
 (0)