Skip to content

Commit 1033f85

Browse files
committed
run clang-format
1 parent 5570118 commit 1033f85

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

libc/src/__support/str_to_integer.h

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ first_non_whitespace(const CharType *__restrict src,
3939
size_t src_cur = 0;
4040
while (src_cur < src_len) {
4141
if constexpr (cpp::is_same_v<CharType, char>) {
42-
if (!internal::isspace(src[src_cur])) break;
42+
if (!internal::isspace(src[src_cur]))
43+
break;
4344
} else {
44-
if (!internal::iswspace(src[src_cur])) break;
45+
if (!internal::iswspace(src[src_cur]))
46+
break;
4547
}
4648
++src_cur;
4749
}
@@ -51,8 +53,8 @@ first_non_whitespace(const CharType *__restrict src,
5153
// Returns 1 if 'src' starts with + or - sign, and returns 0 otherwise.
5254
// Writes the sign value to |is_positive|.
5355
template <typename CharType>
54-
LIBC_INLINE static size_t
55-
consume_sign(const CharType *__restrict src, bool *is_positive) {
56+
LIBC_INLINE static size_t consume_sign(const CharType *__restrict src,
57+
bool *is_positive) {
5658
*is_positive = true;
5759
if constexpr (cpp::is_same_v<CharType, char>) {
5860
if (*src == '+' || *src == '-') {
@@ -70,9 +72,9 @@ consume_sign(const CharType *__restrict src, bool *is_positive) {
7072

7173
// checks if the next 3 characters of the string pointer are the start of a
7274
// hexadecimal number. Does not advance the string pointer.
73-
template<typename CharType>
74-
LIBC_INLINE static bool
75-
is_hex_start(const CharType *__restrict src, size_t src_len) {
75+
template <typename CharType>
76+
LIBC_INLINE static bool is_hex_start(const CharType *__restrict src,
77+
size_t src_len) {
7678
if (src_len < 3)
7779
return false;
7880
if constexpr (cpp::is_same_v<CharType, char>) {
@@ -86,7 +88,7 @@ is_hex_start(const CharType *__restrict src, size_t src_len) {
8688

8789
// Takes the address of the string pointer and parses the base from the start of
8890
// it.
89-
template<typename CharType>
91+
template <typename CharType>
9092
LIBC_INLINE static int infer_base(const CharType *__restrict src,
9193
size_t src_len) {
9294
// A hexadecimal number is defined as "the prefix 0x or 0X followed by a
@@ -99,9 +101,11 @@ LIBC_INLINE static int infer_base(const CharType *__restrict src,
99101
// number that starts with 0, including just 0, is an octal number.
100102
if (src_len > 0) {
101103
if constexpr (cpp::is_same_v<CharType, char>) {
102-
if (src[0] == '0') return 8;
104+
if (src[0] == '0')
105+
return 8;
103106
} else {
104-
if (src[0] == L'0') return 8;
107+
if (src[0] == L'0')
108+
return 8;
105109
}
106110
}
107111
// A decimal number is defined as beginning "with a nonzero digit and
@@ -153,14 +157,16 @@ strtointeger(const CharType *__restrict src, int base,
153157

154158
bool is_number = false;
155159
int error_val = 0;
156-
ResultType result = 0;
160+
ResultType result = 0;
157161
while (src_cur < src_len) {
158162
int cur_digit;
159163
if constexpr (cpp::is_same_v<CharType, char>) {
160-
if (!isalnum(src[src_cur])) break;
164+
if (!isalnum(src[src_cur]))
165+
break;
161166
cur_digit = b36_char_to_int(src[src_cur]);
162167
} else {
163-
if (!iswalnum(src[src_cur])) break;
168+
if (!iswalnum(src[src_cur]))
169+
break;
164170
cur_digit = b36_wchar_to_int(src[src_cur]);
165171
}
166172

0 commit comments

Comments
 (0)