]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseMemoryLib/CopyMem.c
MdePkg: Apply uncrustify changes
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLib / CopyMem.c
index 55e8616c98cb62b87b2378d48b8f8e8fb47bd3a4..929f7007478fe13a743f7cf1d5198ed00fba20c7 100644 (file)
@@ -11,9 +11,6 @@
 \r
 **/\r
 \r
 \r
 **/\r
 \r
-\r
-\r
-\r
 #include "MemLibInternals.h"\r
 \r
 /**\r
 #include "MemLibInternals.h"\r
 \r
 /**\r
@@ -29,9 +26,9 @@
 VOID *\r
 EFIAPI\r
 InternalMemCopyMem (\r
 VOID *\r
 EFIAPI\r
 InternalMemCopyMem (\r
-  OUT     VOID                      *DestinationBuffer,\r
-  IN      CONST VOID                *SourceBuffer,\r
-  IN      UINTN                     Length\r
+  OUT     VOID        *DestinationBuffer,\r
+  IN      CONST VOID  *SourceBuffer,\r
+  IN      UINTN       Length\r
   )\r
 {\r
   //\r
   )\r
 {\r
   //\r
@@ -39,32 +36,32 @@ InternalMemCopyMem (
   // volatile to prevent the optimizer from replacing this function with\r
   // the intrinsic memcpy()\r
   //\r
   // volatile to prevent the optimizer from replacing this function with\r
   // the intrinsic memcpy()\r
   //\r
-  volatile UINT8                    *Destination8;\r
-  CONST UINT8                       *Source8;\r
-  volatile UINT32                   *Destination32;\r
-  CONST UINT32                      *Source32;\r
-  volatile UINT64                   *Destination64;\r
-  CONST UINT64                      *Source64;\r
-  UINTN                             Alignment;\r
+  volatile UINT8   *Destination8;\r
+  CONST UINT8      *Source8;\r
+  volatile UINT32  *Destination32;\r
+  CONST UINT32     *Source32;\r
+  volatile UINT64  *Destination64;\r
+  CONST UINT64     *Source64;\r
+  UINTN            Alignment;\r
 \r
   if ((((UINTN)DestinationBuffer & 0x7) == 0) && (((UINTN)SourceBuffer & 0x7) == 0) && (Length >= 8)) {\r
     if (SourceBuffer > DestinationBuffer) {\r
 \r
   if ((((UINTN)DestinationBuffer & 0x7) == 0) && (((UINTN)SourceBuffer & 0x7) == 0) && (Length >= 8)) {\r
     if (SourceBuffer > DestinationBuffer) {\r
-      Destination64 = (UINT64*)DestinationBuffer;\r
-      Source64 = (CONST UINT64*)SourceBuffer;\r
+      Destination64 = (UINT64 *)DestinationBuffer;\r
+      Source64      = (CONST UINT64 *)SourceBuffer;\r
       while (Length >= 8) {\r
         *(Destination64++) = *(Source64++);\r
       while (Length >= 8) {\r
         *(Destination64++) = *(Source64++);\r
-        Length -= 8;\r
+        Length            -= 8;\r
       }\r
 \r
       // Finish if there are still some bytes to copy\r
       }\r
 \r
       // Finish if there are still some bytes to copy\r
-      Destination8 = (UINT8*)Destination64;\r
-      Source8 = (CONST UINT8*)Source64;\r
+      Destination8 = (UINT8 *)Destination64;\r
+      Source8      = (CONST UINT8 *)Source64;\r
       while (Length-- != 0) {\r
         *(Destination8++) = *(Source8++);\r
       }\r
     } else if (SourceBuffer < DestinationBuffer) {\r
       while (Length-- != 0) {\r
         *(Destination8++) = *(Source8++);\r
       }\r
     } else if (SourceBuffer < DestinationBuffer) {\r
-      Destination64 = (UINT64*)((UINTN)DestinationBuffer + Length);\r
-      Source64 = (CONST UINT64*)((UINTN)SourceBuffer + Length);\r
+      Destination64 = (UINT64 *)((UINTN)DestinationBuffer + Length);\r
+      Source64      = (CONST UINT64 *)((UINTN)SourceBuffer + Length);\r
 \r
       // Destination64 and Source64 were aligned on a 64-bit boundary\r
       // but if length is not a multiple of 8 bytes then they won't be\r
 \r
       // Destination64 and Source64 were aligned on a 64-bit boundary\r
       // but if length is not a multiple of 8 bytes then they won't be\r
@@ -72,40 +69,41 @@ InternalMemCopyMem (
 \r
       Alignment = Length & 0x7;\r
       if (Alignment != 0) {\r
 \r
       Alignment = Length & 0x7;\r
       if (Alignment != 0) {\r
-        Destination8 = (UINT8*)Destination64;\r
-        Source8 = (CONST UINT8*)Source64;\r
+        Destination8 = (UINT8 *)Destination64;\r
+        Source8      = (CONST UINT8 *)Source64;\r
 \r
         while (Alignment-- != 0) {\r
           *(--Destination8) = *(--Source8);\r
           --Length;\r
         }\r
 \r
         while (Alignment-- != 0) {\r
           *(--Destination8) = *(--Source8);\r
           --Length;\r
         }\r
-        Destination64 = (UINT64*)Destination8;\r
-        Source64 = (CONST UINT64*)Source8;\r
+\r
+        Destination64 = (UINT64 *)Destination8;\r
+        Source64      = (CONST UINT64 *)Source8;\r
       }\r
 \r
       while (Length > 0) {\r
         *(--Destination64) = *(--Source64);\r
       }\r
 \r
       while (Length > 0) {\r
         *(--Destination64) = *(--Source64);\r
-        Length -= 8;\r
+        Length            -= 8;\r
       }\r
     }\r
   } else if ((((UINTN)DestinationBuffer & 0x3) == 0) && (((UINTN)SourceBuffer & 0x3) == 0) && (Length >= 4)) {\r
     if (SourceBuffer > DestinationBuffer) {\r
       }\r
     }\r
   } else if ((((UINTN)DestinationBuffer & 0x3) == 0) && (((UINTN)SourceBuffer & 0x3) == 0) && (Length >= 4)) {\r
     if (SourceBuffer > DestinationBuffer) {\r
-      Destination32 = (UINT32*)DestinationBuffer;\r
-      Source32 = (CONST UINT32*)SourceBuffer;\r
+      Destination32 = (UINT32 *)DestinationBuffer;\r
+      Source32      = (CONST UINT32 *)SourceBuffer;\r
       while (Length >= 4) {\r
         *(Destination32++) = *(Source32++);\r
       while (Length >= 4) {\r
         *(Destination32++) = *(Source32++);\r
-        Length -= 4;\r
+        Length            -= 4;\r
       }\r
 \r
       // Finish if there are still some bytes to copy\r
       }\r
 \r
       // Finish if there are still some bytes to copy\r
-      Destination8 = (UINT8*)Destination32;\r
-      Source8 = (CONST UINT8*)Source32;\r
+      Destination8 = (UINT8 *)Destination32;\r
+      Source8      = (CONST UINT8 *)Source32;\r
       while (Length-- != 0) {\r
         *(Destination8++) = *(Source8++);\r
       }\r
     } else if (SourceBuffer < DestinationBuffer) {\r
       while (Length-- != 0) {\r
         *(Destination8++) = *(Source8++);\r
       }\r
     } else if (SourceBuffer < DestinationBuffer) {\r
-      Destination32 = (UINT32*)((UINTN)DestinationBuffer + Length);\r
-      Source32 = (CONST UINT32*)((UINTN)SourceBuffer + Length);\r
+      Destination32 = (UINT32 *)((UINTN)DestinationBuffer + Length);\r
+      Source32      = (CONST UINT32 *)((UINTN)SourceBuffer + Length);\r
 \r
       // Destination32 and Source32 were aligned on a 32-bit boundary\r
       // but if length is not a multiple of 4 bytes then they won't be\r
 \r
       // Destination32 and Source32 were aligned on a 32-bit boundary\r
       // but if length is not a multiple of 4 bytes then they won't be\r
@@ -113,36 +111,38 @@ InternalMemCopyMem (
 \r
       Alignment = Length & 0x3;\r
       if (Alignment != 0) {\r
 \r
       Alignment = Length & 0x3;\r
       if (Alignment != 0) {\r
-        Destination8 = (UINT8*)Destination32;\r
-        Source8 = (CONST UINT8*)Source32;\r
+        Destination8 = (UINT8 *)Destination32;\r
+        Source8      = (CONST UINT8 *)Source32;\r
 \r
         while (Alignment-- != 0) {\r
           *(--Destination8) = *(--Source8);\r
           --Length;\r
         }\r
 \r
         while (Alignment-- != 0) {\r
           *(--Destination8) = *(--Source8);\r
           --Length;\r
         }\r
-        Destination32 = (UINT32*)Destination8;\r
-        Source32 = (CONST UINT32*)Source8;\r
+\r
+        Destination32 = (UINT32 *)Destination8;\r
+        Source32      = (CONST UINT32 *)Source8;\r
       }\r
 \r
       while (Length > 0) {\r
         *(--Destination32) = *(--Source32);\r
       }\r
 \r
       while (Length > 0) {\r
         *(--Destination32) = *(--Source32);\r
-        Length -= 4;\r
+        Length            -= 4;\r
       }\r
     }\r
   } else {\r
     if (SourceBuffer > DestinationBuffer) {\r
       }\r
     }\r
   } else {\r
     if (SourceBuffer > DestinationBuffer) {\r
-      Destination8 = (UINT8*)DestinationBuffer;\r
-      Source8 = (CONST UINT8*)SourceBuffer;\r
+      Destination8 = (UINT8 *)DestinationBuffer;\r
+      Source8      = (CONST UINT8 *)SourceBuffer;\r
       while (Length-- != 0) {\r
         *(Destination8++) = *(Source8++);\r
       }\r
     } else if (SourceBuffer < DestinationBuffer) {\r
       while (Length-- != 0) {\r
         *(Destination8++) = *(Source8++);\r
       }\r
     } else if (SourceBuffer < DestinationBuffer) {\r
-      Destination8 = (UINT8*)DestinationBuffer + (Length - 1);\r
-      Source8 = (CONST UINT8*)SourceBuffer + (Length - 1);\r
+      Destination8 = (UINT8 *)DestinationBuffer + (Length - 1);\r
+      Source8      = (CONST UINT8 *)SourceBuffer + (Length - 1);\r
       while (Length-- != 0) {\r
         *(Destination8--) = *(Source8--);\r
       }\r
     }\r
   }\r
       while (Length-- != 0) {\r
         *(Destination8--) = *(Source8--);\r
       }\r
     }\r
   }\r
+\r
   return DestinationBuffer;\r
 }\r
   return DestinationBuffer;\r
 }\r