summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MdePkg/Library/BaseMemoryLib/MemLibGeneric.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/MdePkg/Library/BaseMemoryLib/MemLibGeneric.c b/MdePkg/Library/BaseMemoryLib/MemLibGeneric.c
index 1e3c4c3f13..a977c4aadc 100644
--- a/MdePkg/Library/BaseMemoryLib/MemLibGeneric.c
+++ b/MdePkg/Library/BaseMemoryLib/MemLibGeneric.c
@@ -162,9 +162,10 @@ InternalMemScanMem8 (
Pointer = (CONST UINT8*)Buffer;
do {
- if (*(Pointer++) == Value) {
- return --Pointer;
+ if (*Pointer == Value) {
+ return Pointer;
}
+ ++Pointer;
} while (--Length != 0);
return NULL;
}
@@ -192,9 +193,10 @@ InternalMemScanMem16 (
Pointer = (CONST UINT16*)Buffer;
do {
- if (*(Pointer++) == Value) {
- return --Pointer;
+ if (*Pointer == Value) {
+ return Pointer;
}
+ ++Pointer;
} while (--Length != 0);
return NULL;
}
@@ -222,9 +224,10 @@ InternalMemScanMem32 (
Pointer = (CONST UINT32*)Buffer;
do {
- if (*(Pointer++) == Value) {
- return --Pointer;
+ if (*Pointer == Value) {
+ return Pointer;
}
+ ++Pointer;
} while (--Length != 0);
return NULL;
}
@@ -252,9 +255,10 @@ InternalMemScanMem64 (
Pointer = (CONST UINT64*)Buffer;
do {
- if (*(Pointer++) == Value) {
- return --Pointer;
+ if (*Pointer == Value) {
+ return Pointer;
}
+ ++Pointer;
} while (--Length != 0);
return NULL;
}