summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Core/Dxe/Mem/Page.c
diff options
context:
space:
mode:
authorrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>2012-08-28 06:48:28 +0000
committerrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>2012-08-28 06:48:28 +0000
commit3d78c020d22023d35d27b48817d73ff31a361ac7 (patch)
tree9ef792efdbd9d74581b4efdec88934420cc86e31 /MdeModulePkg/Core/Dxe/Mem/Page.c
parent055c829c4212f12614ad80dcd161a2b4f5cf6713 (diff)
downloadedk2-platforms-3d78c020d22023d35d27b48817d73ff31a361ac7.tar.xz
Fix comparisons of enumerated types which may cause warnings for some compilers.
Signed-off-by: Sun Rui <rui.sun@intel.com> Reviewed-by: Gao Liming <liming.gao@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13686 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core/Dxe/Mem/Page.c')
-rw-r--r--MdeModulePkg/Core/Dxe/Mem/Page.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c
index b4a62b9f0c..6d5a259eb6 100644
--- a/MdeModulePkg/Core/Dxe/Mem/Page.c
+++ b/MdeModulePkg/Core/Dxe/Mem/Page.c
@@ -557,7 +557,7 @@ CoreAddMemoryDescriptor (
// Make sure the memory type in the gMemoryTypeInformation[] array is valid
//
Type = (EFI_MEMORY_TYPE) (gMemoryTypeInformation[Index].Type);
- if (Type < 0 || Type > EfiMaxMemoryType) {
+ if ((UINT32)Type > EfiMaxMemoryType) {
continue;
}
if (gMemoryTypeInformation[Index].NumberOfPages != 0) {
@@ -581,7 +581,7 @@ CoreAddMemoryDescriptor (
// Make sure the memory type in the gMemoryTypeInformation[] array is valid
//
Type = (EFI_MEMORY_TYPE) (gMemoryTypeInformation[FreeIndex].Type);
- if (Type < 0 || Type > EfiMaxMemoryType) {
+ if ((UINT32)Type > EfiMaxMemoryType) {
continue;
}
@@ -624,7 +624,7 @@ CoreAddMemoryDescriptor (
// Make sure the memory type in the gMemoryTypeInformation[] array is valid
//
Type = (EFI_MEMORY_TYPE) (gMemoryTypeInformation[Index].Type);
- if (Type < 0 || Type > EfiMaxMemoryType) {
+ if ((UINT32)Type > EfiMaxMemoryType) {
continue;
}
if (gMemoryTypeInformation[Index].NumberOfPages != 0) {
@@ -747,7 +747,7 @@ CoreConvertPages (
//
// Update counters for the number of pages allocated to each memory type
//
- if (Entry->Type >= 0 && Entry->Type < EfiMaxMemoryType) {
+ if ((UINT32)Entry->Type < EfiMaxMemoryType) {
if ((Start >= mMemoryTypeStatistics[Entry->Type].BaseAddress && Start <= mMemoryTypeStatistics[Entry->Type].MaximumAddress) ||
(Start >= mDefaultBaseAddress && Start <= mDefaultMaximumAddress) ) {
if (NumberOfPages > mMemoryTypeStatistics[Entry->Type].CurrentNumberOfPages) {
@@ -758,7 +758,7 @@ CoreConvertPages (
}
}
- if (NewType >= 0 && NewType < EfiMaxMemoryType) {
+ if ((UINT32)NewType < EfiMaxMemoryType) {
if ((Start >= mMemoryTypeStatistics[NewType].BaseAddress && Start <= mMemoryTypeStatistics[NewType].MaximumAddress) ||
(Start >= mDefaultBaseAddress && Start <= mDefaultMaximumAddress) ) {
mMemoryTypeStatistics[NewType].CurrentNumberOfPages += NumberOfPages;
@@ -1011,7 +1011,7 @@ FindFreePages (
//
// Attempt to find free pages in the preferred bin based on the requested memory type
//
- if (NewType >= 0 && NewType < EfiMaxMemoryType && MaxAddress >= mMemoryTypeStatistics[NewType].MaximumAddress) {
+ if ((UINT32)NewType < EfiMaxMemoryType && MaxAddress >= mMemoryTypeStatistics[NewType].MaximumAddress) {
Start = CoreFindFreePagesI (
mMemoryTypeStatistics[NewType].MaximumAddress,
mMemoryTypeStatistics[NewType].BaseAddress,
@@ -1094,7 +1094,7 @@ CoreAllocatePages (
UINT64 MaxAddress;
UINTN Alignment;
- if (Type < AllocateAnyPages || Type >= (UINTN) MaxAllocateType) {
+ if ((UINT32)Type >= MaxAllocateType) {
return EFI_INVALID_PARAMETER;
}