| Index: src/utils.h
|
| diff --git a/src/utils.h b/src/utils.h
|
| index ce62c81b8c0128dd46ef8b0262cffb16d5a745ff..1ea2d56fbfd44c4b139871bd29fd64cac104eb1d 100644
|
| --- a/src/utils.h
|
| +++ b/src/utils.h
|
| @@ -26,6 +26,16 @@ namespace internal {
|
| // ----------------------------------------------------------------------------
|
| // General helper functions
|
|
|
| +// Returns the value (0 .. 15) of a hexadecimal character c.
|
| +// If c is not a legal hexadecimal character, returns a value < 0.
|
| +inline int HexValue(uc32 c) {
|
| + c -= '0';
|
| + if (static_cast<unsigned>(c) <= 9) return c;
|
| + c = (c | 0x20) - ('a' - '0'); // detect 0x11..0x16 and 0x31..0x36.
|
| + if (static_cast<unsigned>(c) <= 5) return c + 10;
|
| + return -1;
|
| +}
|
| +
|
|
|
| inline int BoolToInt(bool b) { return b ? 1 : 0; }
|
|
|
|
|