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
This commit is contained in:
qhuang8 2009-01-14 14:11:28 +00:00
parent 7646204cdb
commit bcccf0b071
3 changed files with 13 additions and 15 deletions

View File

@ -40,4 +40,4 @@
[LibraryClasses]
DebugLib
BaseLib
BaseMemoryLib

View File

@ -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.

View File

@ -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.