]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update BaseLib according to code review comments.
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 24 Sep 2008 04:17:16 +0000 (04:17 +0000)
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 24 Sep 2008 04:17:16 +0000 (04:17 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5956 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Library/BaseLib/BaseLibInternals.h
MdePkg/Library/BaseLib/CheckSum.c
MdePkg/Library/BaseLib/Ia32DivS64x64Remainder.c
MdePkg/Library/BaseLib/LinkedList.c
MdePkg/Library/BaseLib/Math64.c
MdePkg/Library/BaseLib/String.c
MdePkg/Library/BaseLib/SwitchStack.c

index 984c0cdfc38db7a00ce34e07564e07c11a2ce964..9c6044b606908d12e73b9317f201fb6045286817 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Declaration of internal functions in BaseLib.\r
 \r
-  Copyright (c) 2006 - 2007, Intel Corporation<BR>\r
+  Copyright (c) 2006 - 2008, Intel Corporation<BR>\r
   All rights reserved. This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
 #include <Library/TimerLib.h>\r
 #include <Library/PcdLib.h>\r
 \r
-\r
-#define QUIENT_MAX_UINTN_DIVIDED_BY_10      ((UINTN) -1 / 10)\r
-#define REMINDER_MAX_UINTN_DIVIDED_BY_10    ((UINTN) -1 % 10)\r
-\r
-#define QUIENT_MAX_UINTN_DIVIDED_BY_16      ((UINTN) -1 / 16)\r
-#define REMINDER_MAX_UINTN_DIVIDED_BY_16    ((UINTN) -1 % 16)\r
-\r
-#define QUIENT_MAX_UINT64_DIVIDED_BY_10      ((UINT64) -1 / 10)\r
-#define REMINDER_MAX_UINT64_DIVIDED_BY_10    ((UINT64) -1 % 10)\r
-\r
-#define QUIENT_MAX_UINT64_DIVIDED_BY_16      ((UINT64) -1 / 16)\r
-#define REMINDER_MAX_UINT64_DIVIDED_BY_16    ((UINT64) -1 % 16)\r
-\r
 //\r
 // Math functions\r
 //\r
@@ -150,7 +137,7 @@ InternalMathRRotU64 (
 \r
   @param  Operand A 64-bit unsigned value.\r
 \r
-  @return The byte swaped Operand.\r
+  @return The byte swapped Operand.\r
 \r
 **/\r
 UINT64\r
@@ -209,7 +196,7 @@ InternalMathMultU64x64 (
   unsigned value Divisor and generates a 64-bit unsigned quotient. This\r
   function returns the 64-bit unsigned quotient.\r
 \r
-   @param  Dividend  A 64-bit unsigned value.\r
+  @param  Dividend  A 64-bit unsigned value.\r
   @param  Divisor   A 32-bit unsigned value.\r
 \r
   @return Dividend / Divisor\r
@@ -295,12 +282,12 @@ InternalMathDivRemU64x64 (
 \r
 /**\r
   Divides a 64-bit signed integer by a 64-bit signed integer and\r
-  generates a  64-bit signed result and a optional 64-bit signed remainder.\r
+  generates a 64-bit signed result and an optional 64-bit signed remainder.\r
 \r
-  This function divides the 64-bit unsigned value Dividend by the 64-bit\r
-  unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder\r
-  is not NULL, then the 64-bit unsigned remainder is returned in Remainder.\r
-  This function returns the 64-bit unsigned quotient.\r
+  This function divides the 64-bit signed value Dividend by the 64-bit\r
+  signed value Divisor and generates a 64-bit signed quotient. If Remainder\r
+  is not NULL, then the 64-bit signed remainder is returned in Remainder.\r
+  This function returns the 64-bit signed quotient.\r
 \r
   @param  Dividend  A 64-bit signed value.\r
   @param  Divisor   A 64-bit signed value.\r
@@ -354,7 +341,7 @@ InternalSwitchStack (
 \r
 \r
 /**\r
-  Worker function that locates the Node in the List\r
+  Worker function that locates the Node in the List.\r
 \r
   By searching the List, finds the location of the Node in List. At the same time,\r
   verifies the validity of this list.\r
@@ -474,7 +461,7 @@ InternalSyncCompareExchange64 (
 \r
 \r
 /**\r
-  Worker function that returns a bit field from Operand\r
+  Worker function that returns a bit field from Operand.\r
 \r
   Returns the bitfield specified by the StartBit and the EndBit from Operand.\r
 \r
index 4991923f475cc58ffa4bc0139a1722c346cc763b..9d031bafa220547386d73d4b9886c1bf7c1cc25a 100644 (file)
@@ -2,7 +2,7 @@
   Utility functions to generate checksum based on 2's complement\r
   algorithm.\r
 \r
-  Copyright (c) 2007, Intel Corporation<BR>\r
+  Copyright (c) 2007 - 2008, Intel Corporation<BR>\r
   All rights reserved. This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -38,8 +38,8 @@
 UINT8\r
 EFIAPI\r
 CalculateSum8 (\r
-  IN      CONST UINT8                  *Buffer,\r
-  IN      UINTN                                      Length\r
+  IN      CONST UINT8        *Buffer,\r
+  IN      UINTN              Length\r
   )\r
 {\r
   UINT8     Sum;\r
@@ -71,14 +71,14 @@ CalculateSum8 (
   @param  Buffer      Pointer to the buffer to carry out the checksum operation.\r
   @param  Length      The size, in bytes, of Buffer.\r
 \r
-  @return Checksum       The 2's complement checksum of Buffer.\r
+  @return Checksum    The 2's complement checksum of Buffer.\r
 \r
 **/\r
 UINT8\r
 EFIAPI\r
 CalculateCheckSum8 (\r
-  IN      CONST UINT8                  *Buffer,\r
-  IN      UINTN                                      Length\r
+  IN      CONST UINT8        *Buffer,\r
+  IN      UINTN              Length\r
   )\r
 {\r
   UINT8     CheckSum;\r
@@ -113,8 +113,8 @@ CalculateCheckSum8 (
 UINT16\r
 EFIAPI\r
 CalculateSum16 (\r
-  IN      CONST UINT16                 *Buffer,\r
-  IN      UINTN                                      Length\r
+  IN      CONST UINT16       *Buffer,\r
+  IN      UINTN              Length\r
   )\r
 {\r
   UINT16    Sum;\r
@@ -152,14 +152,14 @@ CalculateSum16 (
   @param  Buffer      Pointer to the buffer to carry out the checksum operation.\r
   @param  Length      The size, in bytes, of Buffer.\r
 \r
-  @return Checksum       The 2's complement checksum of Buffer.\r
+  @return Checksum    The 2's complement checksum of Buffer.\r
 \r
 **/\r
 UINT16\r
 EFIAPI\r
 CalculateCheckSum16 (\r
-  IN      CONST UINT16                 *Buffer,\r
-  IN      UINTN                                      Length\r
+  IN      CONST UINT16         *Buffer,\r
+  IN      UINTN                Length\r
   )\r
 {\r
   UINT16     CheckSum;\r
@@ -195,8 +195,8 @@ CalculateCheckSum16 (
 UINT32\r
 EFIAPI\r
 CalculateSum32 (\r
-  IN      CONST UINT32                 *Buffer,\r
-  IN      UINTN                                      Length\r
+  IN      CONST UINT32         *Buffer,\r
+  IN      UINTN                Length\r
   )\r
 {\r
   UINT32    Sum;\r
@@ -234,14 +234,14 @@ CalculateSum32 (
   @param  Buffer      Pointer to the buffer to carry out the checksum operation.\r
   @param  Length      The size, in bytes, of Buffer.\r
 \r
-  @return Checksum       The 2's complement checksum of Buffer.\r
+  @return Checksum    The 2's complement checksum of Buffer.\r
 \r
 **/\r
 UINT32\r
 EFIAPI\r
 CalculateCheckSum32 (\r
-  IN      CONST UINT32                 *Buffer,\r
-  IN      UINTN                                      Length\r
+  IN      CONST UINT32         *Buffer,\r
+  IN      UINTN                Length\r
   )\r
 {\r
   UINT32     CheckSum;\r
@@ -277,8 +277,8 @@ CalculateCheckSum32 (
 UINT64\r
 EFIAPI\r
 CalculateSum64 (\r
-  IN      CONST UINT64                 *Buffer,\r
-  IN      UINTN                                      Length\r
+  IN      CONST UINT64         *Buffer,\r
+  IN      UINTN                Length\r
   )\r
 {\r
   UINT64    Sum;\r
@@ -316,14 +316,14 @@ CalculateSum64 (
   @param  Buffer      Pointer to the buffer to carry out the checksum operation.\r
   @param  Length      The size, in bytes, of Buffer.\r
 \r
-  @return Checksum       The 2's complement checksum of Buffer.\r
+  @return Checksum    The 2's complement checksum of Buffer.\r
 \r
 **/\r
 UINT64\r
 EFIAPI\r
 CalculateCheckSum64 (\r
-  IN      CONST UINT64                 *Buffer,\r
-  IN      UINTN                                      Length\r
+  IN      CONST UINT64         *Buffer,\r
+  IN      UINTN                Length\r
   )\r
 {\r
   UINT64     CheckSum;\r
index 6d3b5a47a1be6800c28e8f789788217f4f013970..c5e894f28794d5497dd5369de78601b3118a8749 100644 (file)
   Worker function that Divides a 64-bit signed integer by a 64-bit signed integer and\r
   generates a  64-bit signed result and a optional 64-bit signed remainder.\r
 \r
-  This function divides the 64-bit unsigned value Dividend by the 64-bit\r
-  unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder\r
-  is not NULL, then the 64-bit unsigned remainder is returned in Remainder.\r
-  This function returns the 64-bit unsigned quotient.\r
+  This function divides the 64-bit signed value Dividend by the 64-bit\r
+  signed value Divisor and generates a 64-bit signed quotient. If Remainder\r
+  is not NULL, then the 64-bit signed remainder is returned in Remainder.\r
+  This function returns the 64-bit signed quotient.\r
 \r
   @param  Dividend  A 64-bit signed value.\r
   @param  Divisor   A 64-bit signed value.\r
index 86bc495cc98a922e48abf9f23d74269f4a451e8d..d20c146c11bf891bb761dfd9ab11e8143937a86d 100644 (file)
@@ -25,7 +25,7 @@
 \r
   If List is NULL, then ASSERT().\r
   If List->ForwardLink is NULL, then ASSERT().\r
-  If List->backLink is NULL, then ASSERT().\r
+  If List->BackLink is NULL, then ASSERT().\r
   If Node is NULL, then ASSERT();\r
   If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number\r
   of nodes in ListHead, including the ListHead node, is greater than or\r
@@ -384,7 +384,7 @@ IsNodeAtEnd (
   @param  FirstEntry  A pointer to a node in a linked list.\r
   @param  SecondEntry A pointer to another node in the same linked list.\r
   \r
-  @return SecondEntry\r
+  @return SecondEntry after the nodes are swapped\r
 \r
 **/\r
 LIST_ENTRY *\r
@@ -411,7 +411,7 @@ SwapListEntries (
   Ptr = RemoveEntryList (FirstEntry);\r
 \r
   //\r
-  // If FirstEntry immediately follows SecondEntry, FirstEntry willl be placed\r
+  // If FirstEntry immediately follows SecondEntry, FirstEntry will be placed\r
   // immediately in front of SecondEntry\r
   //\r
   if (Ptr->BackLink == SecondEntry) {\r
@@ -452,7 +452,9 @@ SwapListEntries (
 \r
   @param  Entry A pointer to a node in a linked list\r
 \r
-  @return Entry\r
+  @return The node following Entry in the doubly linked list.\r
+          If Entry is the only node in the linked list, then\r
+          the head node of the linked list is returned.\r
 \r
 **/\r
 LIST_ENTRY *\r
index 5a932ac8a57d4f57a7bf509f2a78861300d249a9..6c5f73203307934ae9b7e86e19fbaa5c17e8af5b 100644 (file)
@@ -2,7 +2,7 @@
   Leaf math worker functions that require 64-bit arithmetic support from the\r
   compiler.\r
 \r
-  Copyright (c) 2006, Intel Corporation<BR>\r
+  Copyright (c) 2006 - 2008, Intel Corporation<BR>\r
   All rights reserved. This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -343,12 +343,12 @@ InternalMathDivRemU64x64 (
 \r
 /**\r
   Divides a 64-bit signed integer by a 64-bit signed integer and\r
-  generates a  64-bit signed result and a optional 64-bit signed remainder.\r
+  generates a 64-bit signed result and a optional 64-bit signed remainder.\r
 \r
-  This function divides the 64-bit unsigned value Dividend by the 64-bit\r
-  unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder\r
-  is not NULL, then the 64-bit unsigned remainder is returned in Remainder.\r
-  This function returns the 64-bit unsigned quotient.\r
+  This function divides the 64-bit signed value Dividend by the 64-bit\r
+  signed value Divisor and generates a 64-bit signed quotient. If Remainder\r
+  is not NULL, then the 64-bit signed remainder is returned in Remainder.\r
+  This function returns the 64-bit signed quotient.\r
 \r
   @param  Dividend  A 64-bit signed value.\r
   @param  Divisor   A 64-bit signed value.\r
index 872642e9580dd1b00c7dec58cdedd6b2368e0129..d292c5852a9a563bb8eaf2f65358ee224b7391f8 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Unicode and ASCII string primatives.\r
 \r
-  Copyright (c) 2006 - 2007, Intel Corporation<BR>\r
+  Copyright (c) 2006 - 2008, Intel Corporation<BR>\r
   All rights reserved. This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
 \r
 #include "BaseLibInternals.h"\r
 \r
+#define QUOTIENT_MAX_UINTN_DIVIDED_BY_10      ((UINTN) -1 / 10)\r
+#define REMAINDER_MAX_UINTN_DIVIDED_BY_10    ((UINTN) -1 % 10)\r
+\r
+#define QUOTIENT_MAX_UINTN_DIVIDED_BY_16      ((UINTN) -1 / 16)\r
+#define REMAINDER_MAX_UINTN_DIVIDED_BY_16    ((UINTN) -1 % 16)\r
+\r
+#define QUOTIENT_MAX_UINT64_DIVIDED_BY_10      ((UINT64) -1 / 10)\r
+#define REMAINDER_MAX_UINT64_DIVIDED_BY_10    ((UINT64) -1 % 10)\r
+\r
+#define QUOTIENT_MAX_UINT64_DIVIDED_BY_16      ((UINT64) -1 / 16)\r
+#define REMAINDER_MAX_UINT64_DIVIDED_BY_16    ((UINT64) -1 % 16)\r
+\r
 /**\r
   Copies one Null-terminated Unicode string to another Null-terminated Unicode\r
   string and returns the new Unicode string.\r
@@ -37,7 +49,7 @@
   @param  Destination Pointer to a Null-terminated Unicode string.\r
   @param  Source      Pointer to a Null-terminated Unicode string.\r
 \r
-  @return Destiantion\r
+  @return Destination pointing to the copied string.\r
 \r
 **/\r
 CHAR16 *\r
@@ -53,7 +65,7 @@ StrCpy (
   // Destination cannot be NULL\r
   //\r
   ASSERT (Destination != NULL);\r
-  ASSERT (((UINTN) Destination & 0x01) == 0);\r
+  ASSERT (((UINTN) Destination & BIT0) == 0);\r
 \r
   //\r
   // Destination and source cannot overlap\r
@@ -95,7 +107,7 @@ StrCpy (
   @param  Source      Pointer to a Null-terminated Unicode string.\r
   @param  Length      Maximum number of Unicode characters to copy.\r
 \r
-  @return Destination\r
+  @return Destination pointing to the copied string.\r
 \r
 **/\r
 CHAR16 *\r
@@ -116,11 +128,10 @@ StrnCpy (
   // Destination cannot be NULL if Length is not zero\r
   //\r
   ASSERT (Destination != NULL);\r
-  ASSERT (((UINTN) Destination & 0x01) == 0);\r
+  ASSERT (((UINTN) Destination & BIT0) == 0);\r
 \r
   //\r
   // Destination and source cannot overlap\r
-  // Q: Does Source have to be NULL-terminated?\r
   //\r
   ASSERT ((UINTN)(Destination - Source) > StrLen (Source));\r
   ASSERT ((UINTN)(Source - Destination) >= Length);\r
@@ -162,7 +173,7 @@ StrLen (
   UINTN                             Length;\r
 \r
   ASSERT (String != NULL);\r
-  ASSERT (((UINTN) String & 0x01) == 0);\r
+  ASSERT (((UINTN) String & BIT0) == 0);\r
 \r
   for (Length = 0; *String != L'\0'; String++, Length++) {\r
     //\r
@@ -228,7 +239,8 @@ StrSize (
   @param  SecondString  Pointer to a Null-terminated Unicode string.\r
 \r
   @retval 0      FirstString is identical to SecondString.\r
-  @return others FirstString is not identical to SecondString.\r
+  @return The first mismatched Unicode character in SecondString subtracted\r
+          from the first mismatched Unicode character in FirstString.\r
 \r
 **/\r
 INTN\r
@@ -278,7 +290,8 @@ StrCmp (
   @param  Length        Maximum number of Unicode characters to compare.\r
 \r
   @retval 0      FirstString is identical to SecondString.\r
-  @return others FirstString is not identical to SecondString.\r
+  @return The value returned is the first mismatched Unicode character in SecondString\r
+          subtracted from the first mismatched Unicode character in FirstString.\r
 \r
 **/\r
 INTN\r
@@ -338,7 +351,7 @@ StrnCmp (
   @param  Destination Pointer to a Null-terminated Unicode string.\r
   @param  Source      Pointer to a Null-terminated Unicode string.\r
 \r
-  @return Destination\r
+  @return Destination pointing to the concatenated Unicode string.\r
 \r
 **/\r
 CHAR16 *\r
@@ -392,7 +405,7 @@ StrCat (
   @param  Length      Maximum number of Unicode characters to concatenate from\r
                       Source.\r
 \r
-  @return Destination\r
+  @return Destination pointing to the concatenated Unicode string.\r
 \r
 **/\r
 CHAR16 *\r
@@ -432,11 +445,11 @@ StrnCat (
   or String contains more than PcdMaximumUnicodeStringLength Unicode \r
   characters not including the Null-terminator, then ASSERT().\r
 \r
-  @param  String                  Pointer to a Null-terminated Unicode string.\r
+  @param  String        Pointer to a Null-terminated Unicode string.\r
   @param  SearchString  Pointer to a Null-terminated Unicode string to search for.\r
 \r
-  @retval NULL            If the SearchString does not appear in String.\r
-  @return others          If there is a match.\r
+  @retval NULL          If the SearchString does not appear in String.\r
+  @return Pointer to the matching sub-string.\r
 \r
 **/\r
 CHAR16 *\r
@@ -495,7 +508,7 @@ StrStr (
   @param  Char  The character to check against.\r
 \r
   @retval TRUE  If the Char is a decmial character.\r
-  @retval FALSE Otherwise.\r
+  @retval FALSE If the Char is not a decmial character.\r
 \r
 **/\r
 BOOLEAN\r
@@ -512,7 +525,7 @@ InternalIsDecimalDigitCharacter (
   it maps to a valid small-case ASCII character.\r
 \r
   This internal function only deal with Unicode character\r
-  which maps to a valid small-case ASII character, i.e.\r
+  which maps to a valid small-case ASCII character, i.e.\r
   L'a' to L'z'. For other Unicode character, the input character\r
   is returned directly.\r
 \r
@@ -546,7 +559,7 @@ InternalCharToUpper (
 \r
   @param  Char  The character to convert.\r
 \r
-  @retval UINTN   The numerical value converted.\r
+  @return The numerical value converted.\r
 \r
 **/\r
 UINTN\r
@@ -573,7 +586,7 @@ InternalHexCharToUintn (
   @param  Char  The character to check against.\r
 \r
   @retval TRUE  If the Char is a hexadecmial character.\r
-  @retval FALSE Otherwise.\r
+  @retval FALSE If the Char is not a hexadecmial character.\r
 \r
 **/\r
 BOOLEAN\r
@@ -619,7 +632,7 @@ InternalIsHexaDecimalDigitCharacter (
 \r
   @param  String                Pointer to a Null-terminated Unicode string.\r
 \r
-  @retval UINTN           \r
+  @return The value of type UINTN converted.\r
 \r
 **/\r
 UINTN\r
@@ -657,9 +670,9 @@ StrDecimalToUintn (
     // If the number represented by String overflows according \r
     // to the range defined by UINTN, then ASSERT().\r
     //\r
-    ASSERT ((Result < QUIENT_MAX_UINTN_DIVIDED_BY_10) ||\r
-      ((QUIENT_MAX_UINTN_DIVIDED_BY_10 == Result) &&\r
-      (*String - L'0') <= REMINDER_MAX_UINTN_DIVIDED_BY_10)\r
+    ASSERT ((Result < QUOTIENT_MAX_UINTN_DIVIDED_BY_10) ||\r
+      ((QUOTIENT_MAX_UINTN_DIVIDED_BY_10 == Result) &&\r
+      (*String - L'0') <= REMAINDER_MAX_UINTN_DIVIDED_BY_10)\r
       );\r
 \r
     Result = Result * 10 + (*String - L'0');\r
@@ -701,7 +714,7 @@ StrDecimalToUintn (
 \r
   @param  String                Pointer to a Null-terminated Unicode string.\r
 \r
-  @retval UINT64           \r
+  @return The value of type UINT64 converted.\r
 \r
 **/\r
 UINT64\r
@@ -739,9 +752,9 @@ StrDecimalToUint64 (
     // If the number represented by String overflows according \r
     // to the range defined by UINTN, then ASSERT().\r
     //\r
-    ASSERT ((Result < QUIENT_MAX_UINT64_DIVIDED_BY_10) || \r
-      ((QUIENT_MAX_UINT64_DIVIDED_BY_10 == Result) && \r
-      (*String - L'0') <= REMINDER_MAX_UINT64_DIVIDED_BY_10)\r
+    ASSERT ((Result < QUOTIENT_MAX_UINT64_DIVIDED_BY_10) || \r
+      ((QUOTIENT_MAX_UINT64_DIVIDED_BY_10 == Result) && \r
+      (*String - L'0') <= REMAINDER_MAX_UINT64_DIVIDED_BY_10)\r
       );\r
 \r
     Result = MultU64x32 (Result, 10) + (*String - L'0');\r
@@ -783,7 +796,7 @@ StrDecimalToUint64 (
 \r
   @param  String                Pointer to a Null-terminated Unicode string.\r
 \r
-  @retval UINTN\r
+  @return The value of type UINTN converted.\r
 \r
 **/\r
 UINTN\r
@@ -832,9 +845,9 @@ StrHexToUintn (
     // If the Hex Number represented by String overflows according \r
     // to the range defined by UINTN, then ASSERT().\r
     //\r
-    ASSERT ((Result < QUIENT_MAX_UINTN_DIVIDED_BY_16) ||\r
-      ((QUIENT_MAX_UINTN_DIVIDED_BY_16 == Result) && \r
-      (InternalHexCharToUintn (*String) <= REMINDER_MAX_UINTN_DIVIDED_BY_16))\r
+    ASSERT ((Result < QUOTIENT_MAX_UINTN_DIVIDED_BY_16) ||\r
+      ((QUOTIENT_MAX_UINTN_DIVIDED_BY_16 == Result) && \r
+      (InternalHexCharToUintn (*String) <= REMAINDER_MAX_UINTN_DIVIDED_BY_16))\r
       );\r
 \r
     Result = (Result << 4) + InternalHexCharToUintn (*String);\r
@@ -877,7 +890,7 @@ StrHexToUintn (
 \r
   @param  String                Pointer to a Null-terminated Unicode string.\r
 \r
-  @retval UINT64\r
+  @return The value of type UINT64 converted.\r
 \r
 **/\r
 UINT64\r
@@ -926,9 +939,9 @@ StrHexToUint64 (
     // If the Hex Number represented by String overflows according \r
     // to the range defined by UINTN, then ASSERT().\r
     //\r
-    ASSERT ((Result < QUIENT_MAX_UINT64_DIVIDED_BY_16)|| \r
-      ((QUIENT_MAX_UINT64_DIVIDED_BY_16 == Result) && \r
-      (InternalHexCharToUintn (*String) <= REMINDER_MAX_UINT64_DIVIDED_BY_16))\r
+    ASSERT ((Result < QUOTIENT_MAX_UINT64_DIVIDED_BY_16)|| \r
+      ((QUOTIENT_MAX_UINT64_DIVIDED_BY_16 == Result) && \r
+      (InternalHexCharToUintn (*String) <= REMAINDER_MAX_UINT64_DIVIDED_BY_16))\r
       );\r
 \r
     Result = LShiftU64 (Result, 4);\r
@@ -949,7 +962,7 @@ StrHexToUint64 (
   @param  Char  The character to check against.\r
 \r
   @retval TRUE  If the Char is a decmial character.\r
-  @retval FALSE Otherwise.\r
+  @retval FALSE If the Char is not a decmial character.\r
 \r
 **/\r
 BOOLEAN\r
@@ -972,7 +985,7 @@ InternalAsciiIsDecimalDigitCharacter (
   @param  Char  The character to check against.\r
 \r
   @retval TRUE  If the Char is a hexadecmial character.\r
-  @retval FALSE Otherwise.\r
+  @retval FALSE If the Char is not a hexadecmial character.\r
 \r
 **/\r
 BOOLEAN\r
@@ -1017,7 +1030,7 @@ InternalAsciiIsHexaDecimalDigitCharacter (
   @param  Source        Pointer to a Null-terminated Unicode string.\r
   @param  Destination   Pointer to a Null-terminated ASCII string.\r
 \r
-  @return Destination\r
+  @return Destination pointing to the converted ASCII string.\r
 \r
 **/\r
 CHAR8 *\r
@@ -1084,7 +1097,7 @@ UnicodeStrToAsciiStr (
   @param  Destination Pointer to a Null-terminated ASCII string.\r
   @param  Source      Pointer to a Null-terminated ASCII string.\r
 \r
-  @return Destination\r
+  @return Destination pointing to the copied string.\r
 \r
 **/\r
 CHAR8 *\r
@@ -1138,7 +1151,7 @@ AsciiStrCpy (
   @param  Source      Pointer to a Null-terminated ASCII string.\r
   @param  Length      Maximum number of ASCII characters to copy.\r
 \r
-  @return Destination\r
+  @return Destination pointing to the copied string.\r
 \r
 **/\r
 CHAR8 *\r
@@ -1264,7 +1277,8 @@ AsciiStrSize (
   @param  SecondString  Pointer to a Null-terminated ASCII string.\r
 \r
   @retval 0      FirstString is identical to SecondString.\r
-  @return others FirstString is not identical to SecondString.\r
+  @return The first mismatched ASCII character in SecondString subtracted\r
+          from the first mismatched ASCII character in FirstString.\r
 \r
 **/\r
 INTN\r
@@ -1289,7 +1303,7 @@ AsciiStrCmp (
 }\r
 \r
 /**\r
-  Converts a lowercase Ascii character to upper one\r
+  Converts a lowercase Ascii character to upper one.\r
 \r
   If Chr is lowercase Ascii character, then converts it to upper one.\r
 \r
@@ -1320,7 +1334,7 @@ AsciiToUpper (
 \r
   @param  Char  The character to convert.\r
 \r
-  @retval UINTN   The numerical value converted.\r
+  @return The numerical value converted.\r
 \r
 **/\r
 UINTN\r
@@ -1362,8 +1376,8 @@ InternalAsciiHexCharToUintn (
 \r
   @retval 0      FirstString is identical to SecondString using case insensitive\r
                  comparisons.\r
-  @return others FirstString is not identical to SecondString using case\r
-                 insensitive comparisons.\r
+  @return The first mismatched lower case ASCII character in SecondString subtracted\r
+          from the first mismatched lower case ASCII character in FirstString.\r
 \r
 **/\r
 INTN\r
@@ -1419,7 +1433,8 @@ AsciiStriCmp (
   @param  Length        Maximum number of ASCII characters to compare.\r
                         \r
   @retval 0      FirstString is identical to SecondString.\r
-  @return others FirstString is not identical to SecondString.\r
+  @return The first mismatched ASCII character in SecondString subtracted from the\r
+          first mismatched ASCII character in FirstString.\r
 \r
 **/\r
 INTN\r
@@ -1474,7 +1489,7 @@ AsciiStrnCmp (
   @param  Destination Pointer to a Null-terminated ASCII string.\r
   @param  Source      Pointer to a Null-terminated ASCII string.\r
 \r
-  @return Destination\r
+  @return Destination pointing to the concatenated ASCII string.\r
 \r
 **/\r
 CHAR8 *\r
@@ -1525,7 +1540,7 @@ AsciiStrCat (
   @param  Length      Maximum number of ASCII characters to concatenate from\r
                       Source.\r
 \r
-  @return Destination\r
+  @return Destination pointing to the concatenated ASCII string.\r
 \r
 **/\r
 CHAR8 *\r
@@ -1566,7 +1581,7 @@ AsciiStrnCat (
   @param  SearchString    Pointer to a Null-terminated ASCII string to search for.\r
 \r
   @retval NULL            If the SearchString does not appear in String.\r
-  @return others          If there is a match.\r
+  @return Pointer to the matching sub-string.\r
 \r
 **/\r
 CHAR8 *\r
@@ -1641,7 +1656,7 @@ AsciiStrStr (
 \r
   @param  String                Pointer to a Null-terminated ASCII string.\r
 \r
-  @retval UINTN           \r
+  @return The value of type UINTN converted.\r
 \r
 **/\r
 UINTN\r
@@ -1678,9 +1693,9 @@ AsciiStrDecimalToUintn (
     // If the number represented by String overflows according \r
     // to the range defined by UINTN, then ASSERT().\r
     //\r
-    ASSERT ((Result < QUIENT_MAX_UINTN_DIVIDED_BY_10) ||\r
-      ((QUIENT_MAX_UINTN_DIVIDED_BY_10 == Result) && \r
-      (*String - '0') <= REMINDER_MAX_UINTN_DIVIDED_BY_10)\r
+    ASSERT ((Result < QUOTIENT_MAX_UINTN_DIVIDED_BY_10) ||\r
+      ((QUOTIENT_MAX_UINTN_DIVIDED_BY_10 == Result) && \r
+      (*String - '0') <= REMAINDER_MAX_UINTN_DIVIDED_BY_10)\r
       );\r
 \r
     Result = Result * 10 + (*String - '0');\r
@@ -1718,7 +1733,7 @@ AsciiStrDecimalToUintn (
 \r
   @param  String                Pointer to a Null-terminated ASCII string.\r
 \r
-  @retval UINT64           \r
+  @return The value of type UINT64 converted.\r
 \r
 **/\r
 UINT64\r
@@ -1755,9 +1770,9 @@ AsciiStrDecimalToUint64 (
     // If the number represented by String overflows according \r
     // to the range defined by UINTN, then ASSERT().\r
     //\r
-    ASSERT ((Result < QUIENT_MAX_UINT64_DIVIDED_BY_10) || \r
-      ((QUIENT_MAX_UINT64_DIVIDED_BY_10 == Result) && \r
-      (*String - '0') <= REMINDER_MAX_UINT64_DIVIDED_BY_10)\r
+    ASSERT ((Result < QUOTIENT_MAX_UINT64_DIVIDED_BY_10) || \r
+      ((QUOTIENT_MAX_UINT64_DIVIDED_BY_10 == Result) && \r
+      (*String - '0') <= REMAINDER_MAX_UINT64_DIVIDED_BY_10)\r
       );\r
 \r
     Result = MultU64x32 (Result, 10) + (*String - '0');\r
@@ -1798,7 +1813,7 @@ AsciiStrDecimalToUint64 (
 \r
   @param  String                Pointer to a Null-terminated ASCII string.\r
 \r
-  @retval UINTN\r
+  @return The value of type UINTN converted.\r
 \r
 **/\r
 UINTN\r
@@ -1846,9 +1861,9 @@ AsciiStrHexToUintn (
     // If the Hex Number represented by String overflows according \r
     // to the range defined by UINTN, then ASSERT().\r
     //\r
-     ASSERT ((Result < QUIENT_MAX_UINTN_DIVIDED_BY_16) ||\r
-       ((QUIENT_MAX_UINTN_DIVIDED_BY_16 == Result) && \r
-       (InternalAsciiHexCharToUintn (*String) <= REMINDER_MAX_UINTN_DIVIDED_BY_16))\r
+     ASSERT ((Result < QUOTIENT_MAX_UINTN_DIVIDED_BY_16) ||\r
+       ((QUOTIENT_MAX_UINTN_DIVIDED_BY_16 == Result) && \r
+       (InternalAsciiHexCharToUintn (*String) <= REMAINDER_MAX_UINTN_DIVIDED_BY_16))\r
        );\r
 \r
     Result = (Result << 4) + InternalAsciiHexCharToUintn (*String);\r
@@ -1890,7 +1905,7 @@ AsciiStrHexToUintn (
 \r
   @param  String                Pointer to a Null-terminated ASCII string.\r
 \r
-  @retval UINT64\r
+  @return The value of type UINT64 converted.\r
 \r
 **/\r
 UINT64\r
@@ -1941,9 +1956,9 @@ AsciiStrHexToUint64 (
     // If the Hex Number represented by String overflows according \r
     // to the range defined by UINTN, then ASSERT().\r
     //\r
-    ASSERT ((Result < QUIENT_MAX_UINT64_DIVIDED_BY_16) ||\r
-      ((QUIENT_MAX_UINT64_DIVIDED_BY_16 == Result) && \r
-      (InternalAsciiHexCharToUintn (*String) <= REMINDER_MAX_UINT64_DIVIDED_BY_16))\r
+    ASSERT ((Result < QUOTIENT_MAX_UINT64_DIVIDED_BY_16) ||\r
+      ((QUOTIENT_MAX_UINT64_DIVIDED_BY_16 == Result) && \r
+      (InternalAsciiHexCharToUintn (*String) <= REMAINDER_MAX_UINT64_DIVIDED_BY_16))\r
       );\r
 \r
     Result = LShiftU64 (Result, 4);\r
@@ -1979,7 +1994,7 @@ AsciiStrHexToUint64 (
   @param  Source        Pointer to a Null-terminated ASCII string.\r
   @param  Destination   Pointer to a Null-terminated Unicode string.\r
 \r
-  @return Destination\r
+  @return Destination pointing to the converted Unicode string.\r
 \r
 **/\r
 CHAR16 *\r
@@ -2032,7 +2047,7 @@ AsciiStrToUnicodeStr (
 \r
   @param  Value The 8-bit value to convert to BCD. Range 0..99.\r
 \r
-  @return The BCD value\r
+  @return The BCD value converted.\r
 \r
 **/\r
 UINT8\r
@@ -2056,7 +2071,7 @@ DecimalToBcd8 (
 \r
   @param  Value The 8-bit BCD value to convert to an 8-bit value.\r
 \r
-  @return The 8-bit value is returned.\r
+  @return The 8-bit decimal value converted.\r
 \r
 **/\r
 UINT8\r
@@ -2082,7 +2097,7 @@ BcdToDecimal8 (
 \r
   @param Nibble     The nibble which is in the low 4 bits of the input byte.\r
 \r
-  @retval  CHAR16   The Unicode hexadecimal character.\r
+  @return   The Unicode hexadecimal character.\r
   \r
 **/\r
 CHAR16\r
@@ -2113,18 +2128,17 @@ NibbleToHexChar (
   the input buffer for a 64-bits unsigned integrer 0x12345678abcdef1234 will be converted to\r
   a Unicode string equal to L"12345678abcdef1234".\r
 \r
-  @param String                        On input, String is pointed to the buffer allocated for the convertion.\r
-  @param StringLen                     The Length of String buffer to hold the output String. The length must include the tailing '\0' character.\r
-                                       The StringLen required to convert a N bytes Buffer will be a least equal to or greater \r
-                                       than 2*N + 1.\r
-  @param Buffer                        The pointer to a input buffer.\r
-  @param BufferSizeInBytes             Lenth in bytes of the input buffer.\r
+  @param String                 Pointer to the buffer allocated for the convertion.\r
+  @param StringLen              On input: Pointer to length in bytes of buffer to hold the Unicode string.\r
+                                On output:If return EFI_SUCCESS, pointer to length of Unicode string converted.\r
+                                          If return EFI_BUFFER_TOO_SMALL, pointer to length of string buffer desired.\r
+  @param Buffer                 The pointer to a input buffer.\r
+  @param BufferSizeInBytes      Lenth in bytes of the input buffer.\r
   \r
-\r
-  @retval  EFI_SUCCESS                 The convertion is successfull. All bytes in Buffer has been convert to the corresponding\r
-                                       Unicode character and placed into the right place in String.\r
-  @retval  EFI_BUFFER_TOO_SMALL        StringSizeInBytes is smaller than 2 * N + 1the number of bytes required to\r
-                                       complete the convertion. \r
+  @retval EFI_SUCCESS           The convertion is successfull. All bytes in Buffer has been convert to the corresponding\r
+                                Unicode character and placed into the right place in String.\r
+  @retval EFI_BUFFER_TOO_SMALL  StringSizeInBytes is smaller than 2 * N + 1the number of bytes required to\r
+                                complete the convertion. \r
 **/\r
 RETURN_STATUS\r
 EFIAPI\r
@@ -2275,10 +2289,9 @@ HexStringToBuf (
   Unicode character is converted to a byte. For example, Unicode character\r
   L'A' will be converted to 0x0A. \r
 \r
-  If Digit is NULL, then ASSERT.\r
+  If Digit is NULL, then ASSERT().\r
   \r
   @param  Digit       The output hexadecimal digit.\r
-\r
   @param  Char        The input Unicode character.\r
 \r
   @retval TRUE        Char is in the range of Hexadecimal number. Digit is updated\r
index ab7185677383886ed16f168eeefb6e198088ab5e..b2a4af683b2e225457b29b26e09d51cc1a5d31bf 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Switch Stack functions.\r
 \r
-  Copyright (c) 2006 - 2007, Intel Corporation<BR>\r
+  Copyright (c) 2006 - 2008, Intel Corporation<BR>\r
   All rights reserved. This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -39,7 +39,6 @@
                       function.\r
   @param  NewStack    A pointer to the new stack to use for the EntryPoint\r
                       function.\r
-  @param  ...         Extended parameters.\r
 \r
 **/\r
 VOID\r