diff options
Diffstat (limited to 'MdePkg/Library/BaseMemoryLibMmx/SetMem16Wrapper.c')
-rw-r--r-- | MdePkg/Library/BaseMemoryLibMmx/SetMem16Wrapper.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/MdePkg/Library/BaseMemoryLibMmx/SetMem16Wrapper.c b/MdePkg/Library/BaseMemoryLibMmx/SetMem16Wrapper.c index dea31608fe..fd3720cd51 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/SetMem16Wrapper.c +++ b/MdePkg/Library/BaseMemoryLibMmx/SetMem16Wrapper.c @@ -32,7 +32,7 @@ Value, and returns Buffer. Value is repeated every 16-bits in for Length
bytes of Buffer.
- If Buffer is NULL and Length > 0, then ASSERT().
+ If Length > 0 and Buffer is NULL and Length > 0, then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
If Length is not aligned on a 16-bit boundary, then ASSERT().
@@ -52,13 +52,14 @@ SetMem16 ( IN UINT16 Value
)
{
- ASSERT (!(Buffer == NULL && Length > 0));
- ASSERT (Length <= MAX_ADDRESS - (UINTN)Buffer + 1);
+ if (Length == 0) {
+ return Buffer;
+ }
+
+ ASSERT (Buffer != NULL);
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0);
ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- if ((Length /= sizeof (Value)) == 0) {
- return Buffer;
- }
- return InternalMemSetMem16 (Buffer, Length, Value);
+ return InternalMemSetMem16 (Buffer, Length / sizeof (Value), Value);
}
|