http://git.etherboot.org
/
people
/
xl0
/
gpxe.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5753f2c
)
Note to self: do not write code late at night
author
Michael Brown
<mcb30@etherboot.org>
Wed, 15 Nov 2006 04:16:26 +0000
(
04:16
+0000)
committer
Michael Brown
<mcb30@etherboot.org>
Wed, 15 Nov 2006 04:16:26 +0000
(
04:16
+0000)
src/core/misc.c
patch
|
blob
|
history
diff --git
a/src/core/misc.c
b/src/core/misc.c
index
2a92631
..
c80eacd
100644
(file)
--- a/
src/core/misc.c
+++ b/
src/core/misc.c
@@
-167,11
+167,14
@@
unsigned long strtoul ( const char *p, char **endp, int base ) {
}
while ( 1 ) {
}
while ( 1 ) {
- charval = ( *p - '0' );
- if ( charval > ( 'A' - '0' - 10 ) )
- charval -= ( 'A' - '0' - 10 );
- if ( charval > ( 'a' - 'A' ) )
- charval -= ( 'a' - 'A' );
+ charval = *p;
+ if ( charval >= 'a' ) {
+ charval = ( charval - 'a' + 10 );
+ } else if ( charval >= 'A' ) {
+ charval = ( charval - 'A' + 10 );
+ } else {
+ charval = ( charval - '0' );
+ }
if ( charval >= ( unsigned int ) base )
break;
ret = ( ( ret * base ) + charval );
if ( charval >= ( unsigned int ) base )
break;
ret = ( ( ret * base ) + charval );