We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
parse_with_prefix
1 parent cdb9bbe commit 6aef60eCopy full SHA for 6aef60e
libc/src/__support/integer_literals.h
@@ -153,12 +153,13 @@ LIBC_INLINE constexpr T parse_with_prefix(const char *ptr) {
153
using P = Parser<T>;
154
if (ptr == nullptr)
155
return T();
156
- else if (ptr[0] == '0' && ptr[1] == 'x')
157
- return P::template parse<16>(ptr + 2);
158
- else if (ptr[0] == '0' && ptr[1] == 'b')
159
- return P::template parse<2>(ptr + 2);
160
- else
161
- return P::template parse<10>(ptr);
+ if (ptr[0] == '0') {
+ if (ptr[1] == 'b')
+ return P::template parse<2>(ptr + 2);
+ if (ptr[1] == 'x')
+ return P::template parse<16>(ptr + 2);
+ }
162
+ return P::template parse<10>(ptr);
163
}
164
165
} // namespace internal
0 commit comments