- //\r
- // ASSERT Strings is less long than PcdMaximumAsciiStringLength\r
- //\r
- ASSERT (AsciiStrSize (String) != 0);\r
- \r
- //\r
- // Ignore the pad spaces (space or tab) and leading Zeros\r
- //\r
- //\r
- // Ignore the pad spaces (space or tab) \r
- //\r
- while ((*String == ' ') || (*String == '\t' )) {\r
- String++;\r
- }\r
-\r
- //\r
- // Ignore leading Zeros after the spaces\r
- //\r
- while (*String == '0') {\r
- String++;\r
- }\r
-\r
- if (InternalBaseLibAsciiToUpper (*String) == 'X') {\r
- ASSERT (*(String - 1) == '0');\r
- if (*(String - 1) != '0') {\r
- return 0;\r
- }\r
- //\r
- // Skip the 'X'\r
- //\r
- String++;\r
- }\r
-\r
- Result = 0;\r
- \r
- while (InternalAsciiIsHexaDecimalDigitCharacter (*String)) {\r
- //\r
- // If the Hex Number represented by String overflows according \r
- // to the range defined by UINTN, then ASSERT().\r
- //\r
- ASSERT (Result <= RShiftU64 (((UINT64) ~0) - InternalHexCharToUintn (*String) , 4));\r
-\r
- Result = LShiftU64 (Result, 4);\r
- Result = Result + InternalAsciiHexCharToUintn (*String);\r
- String++;\r
- }\r
-\r