libluna: Allow passing a base to scan_(un)signed_integer()
This commit is contained in:
parent
8c2348c425
commit
a2c081f219
@ -2,10 +2,10 @@
|
||||
#include <luna/Types.h>
|
||||
|
||||
// Parse an unsigned integer and advance *str to point to the first non-digit character after the number.
|
||||
usize scan_unsigned_integer(const char** str);
|
||||
usize scan_unsigned_integer(const char** str, int base = 10);
|
||||
|
||||
// Parse a signed integer and advance *str to point to the first non-digit character after the number.
|
||||
isize scan_signed_integer(const char** str);
|
||||
isize scan_signed_integer(const char** str, int base = 10);
|
||||
|
||||
// Parse an unsigned integer, similar to strtoull().
|
||||
usize parse_unsigned_integer(const char* str, const char** endptr, int base);
|
||||
|
@ -89,12 +89,12 @@ isize parse_signed_integer(const char* str, const char** endptr, int base)
|
||||
return negative ? -(isize)rc : (isize)rc;
|
||||
}
|
||||
|
||||
usize scan_unsigned_integer(const char** str)
|
||||
usize scan_unsigned_integer(const char** str, int base)
|
||||
{
|
||||
return parse_unsigned_integer(*str, str, 10);
|
||||
return parse_unsigned_integer(*str, str, base);
|
||||
}
|
||||
|
||||
isize scan_signed_integer(const char** str)
|
||||
isize scan_signed_integer(const char** str, int base)
|
||||
{
|
||||
return parse_signed_integer(*str, str, 10);
|
||||
return parse_signed_integer(*str, str, base);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user