1) Add BufToHexString, HexStringToBuf and IsHexDigit to BaseLib.

2) Remove the duplicated functions implementation  from the modules that reference these APIs 

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5283 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12
2008-05-23 05:30:08 +00:00
parent d9e5c1fffb
commit 36fe40c2ea
21 changed files with 146 additions and 974 deletions

View File

@@ -24,44 +24,6 @@ Abstract:
STATIC CONST CHAR8 IScsiHexString[] = "0123456789ABCDEFabcdef";
/**
Determines if a Unicode character is a hexadecimal digit.
The test is case insensitive.
@param Digit[out] Pointer to byte that receives the value of the hex character.
@param Char[in] Unicode character to test.
@retval TRUE If the character is a hexadecimal digit.
@retval FALSE Otherwise.
**/
static
BOOLEAN
IsHexDigit (
OUT UINT8 *Digit,
IN CHAR16 Char
)
{
if ((Char >= L'0') && (Char <= L'9')) {
*Digit = (UINT8) (Char - L'0');
return TRUE;
}
if ((Char >= L'A') && (Char <= L'F')) {
*Digit = (UINT8) (Char - L'A' + 0x0A);
return TRUE;
}
if ((Char >= L'a') && (Char <= L'f')) {
*Digit = (UINT8) (Char - L'a' + 0x0A);
return TRUE;
}
return FALSE;
}
/**
Removes (trims) specified leading and trailing characters from a string.