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 | |
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')
-rw-r--r-- | MdePkg/Library/BasePrintLib/BasePrintLib.inf | 2 | ||||
-rw-r--r-- | MdePkg/Library/BasePrintLib/PrintLibInternal.c | 23 | ||||
-rw-r--r-- | MdePkg/Library/BasePrintLib/PrintLibInternal.h | 3 |
3 files changed, 13 insertions, 15 deletions
diff --git a/MdePkg/Library/BasePrintLib/BasePrintLib.inf b/MdePkg/Library/BasePrintLib/BasePrintLib.inf index 4165d5a31e..21d6c20a45 100644 --- a/MdePkg/Library/BasePrintLib/BasePrintLib.inf +++ b/MdePkg/Library/BasePrintLib/BasePrintLib.inf @@ -40,4 +40,4 @@ [LibraryClasses]
DebugLib
BaseLib
-
+ BaseMemoryLib
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.
diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.h b/MdePkg/Library/BasePrintLib/PrintLibInternal.h index 417d3e60f0..151ea61898 100644 --- a/MdePkg/Library/BasePrintLib/PrintLibInternal.h +++ b/MdePkg/Library/BasePrintLib/PrintLibInternal.h @@ -19,6 +19,7 @@ #include <Library/PrintLib.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
//
@@ -138,7 +139,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.
|