mirror of
https://github.com/ipxe/ipxe
synced 2025-12-21 12:30:20 +03:00
[base16] Generalise base16_decode() to hex_decode()
Provide a generic hex_decode() routine which can be shared between the Base16 code and the "hex" and "hexhyp" settings parsers. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -34,19 +34,7 @@ static inline int strtoul_base ( const char **pp, int base )
|
||||
return base;
|
||||
}
|
||||
|
||||
static inline unsigned int strtoul_charval ( unsigned int charval )
|
||||
{
|
||||
if ( charval >= 'a' ) {
|
||||
charval = ( charval - 'a' + 10 );
|
||||
} else if ( charval >= 'A' ) {
|
||||
charval = ( charval - 'A' + 10 );
|
||||
} else if ( charval <= '9' ) {
|
||||
charval = ( charval - '0' );
|
||||
}
|
||||
|
||||
return charval;
|
||||
}
|
||||
|
||||
extern unsigned int strtoul_charval ( unsigned int charval );
|
||||
extern unsigned long strtoul ( const char *p, char **endp, int base );
|
||||
extern unsigned long long strtoull ( const char *p, char **endp, int base );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user