]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Csm/CsmSupportLib/LegacyRegion.c
OvmfPkg: Make more use of ARRAY_SIZE()
[mirror_edk2.git] / OvmfPkg / Csm / CsmSupportLib / LegacyRegion.c
index b929db04d9c5b82e5a50f4c99558848bd2acebf0..8d5d2e58a99438e1b9b81739f28cf3900ec81667 100644 (file)
@@ -130,18 +130,18 @@ LegacyRegionManipulationInternal (
   // Loop to find the start PAM.\r
   //\r
   StartIndex = 0;\r
-  for (Index = 0; Index < (sizeof(mSectionArray) / sizeof (mSectionArray[0])); Index++) {\r
+  for (Index = 0; Index < ARRAY_SIZE (mSectionArray); Index++) {\r
     if ((Start >= mSectionArray[Index].Start) && (Start < (mSectionArray[Index].Start + mSectionArray[Index].Length))) {\r
       StartIndex = Index;\r
       break;\r
     }\r
   }\r
-  ASSERT (Index < (sizeof(mSectionArray) / sizeof (mSectionArray[0])));\r
+  ASSERT (Index < ARRAY_SIZE (mSectionArray));\r
 \r
   //\r
   // Program PAM until end PAM is encountered\r
   //\r
-  for (Index = StartIndex; Index < (sizeof(mSectionArray) / sizeof (mSectionArray[0])); Index++) {\r
+  for (Index = StartIndex; Index < ARRAY_SIZE (mSectionArray); Index++) {\r
     if (ReadEnable != NULL) {\r
       if (*ReadEnable) {\r
         PciOr8 (\r
@@ -177,7 +177,7 @@ LegacyRegionManipulationInternal (
       break;\r
     }\r
   }\r
-  ASSERT (Index < (sizeof(mSectionArray) / sizeof (mSectionArray[0])));\r
+  ASSERT (Index < ARRAY_SIZE (mSectionArray));\r
 \r
   return EFI_SUCCESS;\r
 }\r