Permalink
Browse files

make hexbyte more self-documenting

  • Loading branch information...
zhemao committed Jun 29, 2012
1 parent ffe8694 commit c698f85dca4494e266784708f426bf6af70c97b2
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/bson.c
View
@@ -117,11 +117,11 @@ MONGO_EXPORT const char *bson_data( const bson *b ) {
static char hexbyte( char hex ) {
if (hex >= '0' && hex <= '9')
- return (hex - 0x30);
+ return (hex - '0');
else if (hex >= 'A' && hex <= 'F')
- return (hex - 0x37);
+ return (hex - 'A' + 10);
else if (hex >= 'a' && hex <= 'f')
- return (hex - 0x57);
+ return (hex - 'a' + 10);
else
return 0x0;
}

0 comments on commit c698f85

Please sign in to comment.