Fix a bug to judege max value of UINT32, 0xFFFFFFFF is invalid UINT32 in JAVA.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@560 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
klu2 2006-06-19 09:13:44 +00:00
parent bab72a575b
commit e59cdca8e8
1 changed files with 13 additions and 2 deletions

View File

@ -593,14 +593,25 @@ public class Token {
public boolean isValidNullValue(String judgedValue) {
int intValue;
String subStr;
BigInteger bigIntValue;
switch (datumType) {
case UINT8:
case UINT16:
case UINT32:
intValue = Integer.decode(judgedValue);
if (intValue == 0) {
if (judgedValue.length() > 2) {
if ((judgedValue.charAt(0) == '0') &&
((judgedValue.charAt(1) == 'x') || (judgedValue.charAt(1) == 'X'))){
subStr = judgedValue.substring(2, judgedValue.length());
bigIntValue = new BigInteger(subStr, 16);
} else {
bigIntValue = new BigInteger(judgedValue);
}
} else {
bigIntValue = new BigInteger(judgedValue);
}
if (bigIntValue.bitCount() == 0) {
return true;
}
break;