diff options
author | qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-01-14 14:11:28 +0000 |
---|---|---|
committer | qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-01-14 14:11:28 +0000 |
commit | bcccf0b071386f25def10d6b088b1615b9505f11 (patch) | |
tree | 7802c791134f1962941806d1e028797955880505 /MdePkg/Library/BasePrintLib/PrintLibInternal.c | |
parent | 7646204cdbd71f11635f37dcaea34acbfb79c993 (diff) | |
download | edk2-platforms-bcccf0b071386f25def10d6b088b1615b9505f11.tar.xz |
Apply BaseMemoryLib to replace the for loop.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7278 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/BasePrintLib/PrintLibInternal.c')
-rw-r--r-- | MdePkg/Library/BasePrintLib/PrintLibInternal.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.c b/MdePkg/Library/BasePrintLib/PrintLibInternal.c index 6f0f5e5438..3e1d5484a7 100644 --- a/MdePkg/Library/BasePrintLib/PrintLibInternal.c +++ b/MdePkg/Library/BasePrintLib/PrintLibInternal.c @@ -76,20 +76,17 @@ BasePrintLibFillBuffer ( IN INTN Increment
)
{
- INTN Index;
- if(Increment != 1) {
- for (Index = 0; Index < Length && Buffer < EndBuffer; Index++) {
- *Buffer = (CHAR8) Character;
- *(Buffer + 1) = (CHAR8) (Character >> 8);
- Buffer += Increment;
- }
+ UINTN FillBufferSize;
+
+ if(Increment == 1) {
+ FillBufferSize = MIN (Length, (EndBuffer - Buffer));
+ Buffer = SetMem (Buffer, FillBufferSize, (UINT8) Character);
} else {
- for (Index = 0; Index < Length && Buffer < EndBuffer; Index++) {
- *Buffer = (CHAR8) Character;
- Buffer += Increment;
- }
+ FillBufferSize = MIN (Length << 1, (EndBuffer - Buffer));
+ Buffer = SetMem16 (Buffer, FillBufferSize, (UINT16) Character);
}
- return Buffer;
+
+ return Buffer + FillBufferSize;
}
/**
@@ -98,7 +95,7 @@ BasePrintLibFillBuffer ( Print worker function that convert a decimal number to a string in Buffer.
@param Buffer Location to place the Unicode or ASCII string of Value.
- @param Value Value to convert to a Decimal or Hexidecimal string in Buffer.
+ @param Value Value to convert to a Decimal or Hexadecimal string in Buffer.
@param Radix Radix of the value
@return Number of characters printed.
|