summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MdePkg/Library/BaseMemoryLib/MemLibGeneric.c18
-rw-r--r--MdePkg/Library/PeiMemoryLib/MemLibGeneric.c18
-rw-r--r--MdePkg/Library/UefiMemoryLib/MemLibGeneric.c18
3 files changed, 27 insertions, 27 deletions
diff --git a/MdePkg/Library/BaseMemoryLib/MemLibGeneric.c b/MdePkg/Library/BaseMemoryLib/MemLibGeneric.c
index b058be8f71..cf40ace1fa 100644
--- a/MdePkg/Library/BaseMemoryLib/MemLibGeneric.c
+++ b/MdePkg/Library/BaseMemoryLib/MemLibGeneric.c
@@ -37,9 +37,9 @@ InternalMemSetMem16 (
IN UINT16 Value
)
{
- do {
- ((UINT16*)Buffer)[--Length] = Value;
- } while (Length != 0);
+ for (; Length != 0; Length--) {
+ ((UINT16*)Buffer)[Length - 1] = Value;
+ }
return Buffer;
}
@@ -61,9 +61,9 @@ InternalMemSetMem32 (
IN UINT32 Value
)
{
- do {
- ((UINT32*)Buffer)[--Length] = Value;
- } while (Length != 0);
+ for (; Length != 0; Length--) {
+ ((UINT32*)Buffer)[Length - 1] = Value;
+ }
return Buffer;
}
@@ -85,9 +85,9 @@ InternalMemSetMem64 (
IN UINT64 Value
)
{
- do {
- ((UINT64*)Buffer)[--Length] = Value;
- } while (Length != 0);
+ for (; Length != 0; Length--) {
+ ((UINT64*)Buffer)[Length - 1] = Value;
+ }
return Buffer;
}
diff --git a/MdePkg/Library/PeiMemoryLib/MemLibGeneric.c b/MdePkg/Library/PeiMemoryLib/MemLibGeneric.c
index 490b244097..ed18b57582 100644
--- a/MdePkg/Library/PeiMemoryLib/MemLibGeneric.c
+++ b/MdePkg/Library/PeiMemoryLib/MemLibGeneric.c
@@ -37,9 +37,9 @@ InternalMemSetMem16 (
IN UINT16 Value
)
{
- do {
- ((UINT16*)Buffer)[--Length] = Value;
- } while (Length != 0);
+ for (; Length != 0; Length--) {
+ ((UINT16*)Buffer)[Length - 1] = Value;
+ }
return Buffer;
}
@@ -61,9 +61,9 @@ InternalMemSetMem32 (
IN UINT32 Value
)
{
- do {
- ((UINT32*)Buffer)[--Length] = Value;
- } while (Length != 0);
+ for (; Length != 0; Length--) {
+ ((UINT32*)Buffer)[Length - 1] = Value;
+ }
return Buffer;
}
@@ -85,9 +85,9 @@ InternalMemSetMem64 (
IN UINT64 Value
)
{
- do {
- ((UINT64*)Buffer)[--Length] = Value;
- } while (Length != 0);
+ for (; Length != 0; Length--) {
+ ((UINT64*)Buffer)[Length - 1] = Value;
+ }
return Buffer;
}
diff --git a/MdePkg/Library/UefiMemoryLib/MemLibGeneric.c b/MdePkg/Library/UefiMemoryLib/MemLibGeneric.c
index da02b6c52f..f1efdbb413 100644
--- a/MdePkg/Library/UefiMemoryLib/MemLibGeneric.c
+++ b/MdePkg/Library/UefiMemoryLib/MemLibGeneric.c
@@ -37,9 +37,9 @@ InternalMemSetMem16 (
IN UINT16 Value
)
{
- do {
- ((UINT16*)Buffer)[--Length] = Value;
- } while (Length != 0);
+ for (; Length != 0; Length--) {
+ ((UINT16*)Buffer)[Length - 1] = Value;
+ }
return Buffer;
}
@@ -61,9 +61,9 @@ InternalMemSetMem32 (
IN UINT32 Value
)
{
- do {
- ((UINT32*)Buffer)[--Length] = Value;
- } while (Length != 0);
+ for (; Length != 0; Length--) {
+ ((UINT32*)Buffer)[Length - 1] = Value;
+ }
return Buffer;
}
@@ -85,9 +85,9 @@ InternalMemSetMem64 (
IN UINT64 Value
)
{
- do {
- ((UINT64*)Buffer)[--Length] = Value;
- } while (Length != 0);
+ for (; Length != 0; Length--) {
+ ((UINT64*)Buffer)[Length - 1] = Value;
+ }
return Buffer;
}