]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseLib/QuickSort.c
MdePkg: Apply uncrustify changes
[mirror_edk2.git] / MdePkg / Library / BaseLib / QuickSort.c
index a825c072b021f72d0196729a2f18b8e98adf970a..d9f0e9a0f475d92fbbe4acc34e8db9c0b0424e34 100644 (file)
 VOID\r
 EFIAPI\r
 QuickSort (\r
-  IN OUT VOID                           *BufferToSort,\r
-  IN CONST UINTN                        Count,\r
-  IN CONST UINTN                        ElementSize,\r
-  IN       BASE_SORT_COMPARE            CompareFunction,\r
-  OUT VOID                              *BufferOneElement\r
+  IN OUT VOID                 *BufferToSort,\r
+  IN CONST UINTN              Count,\r
+  IN CONST UINTN              ElementSize,\r
+  IN       BASE_SORT_COMPARE  CompareFunction,\r
+  OUT VOID                    *BufferOneElement\r
   )\r
 {\r
-  VOID        *Pivot;\r
-  UINTN       LoopCount;\r
-  UINTN       NextSwapLocation;\r
+  VOID   *Pivot;\r
+  UINTN  LoopCount;\r
+  UINTN  NextSwapLocation;\r
 \r
   ASSERT (BufferToSort     != NULL);\r
   ASSERT (CompareFunction  != NULL);\r
@@ -59,7 +59,7 @@ QuickSort (
   //\r
   // pick a pivot (we choose last element)\r
   //\r
-  Pivot = ((UINT8*) BufferToSort + ((Count - 1) * ElementSize));\r
+  Pivot = ((UINT8 *)BufferToSort + ((Count - 1) * ElementSize));\r
 \r
   //\r
   // Now get the pivot such that all on "left" are below it\r
@@ -69,13 +69,13 @@ QuickSort (
     //\r
     // if the element is less than or equal to the pivot\r
     //\r
-    if (CompareFunction ((VOID*) ((UINT8*) BufferToSort + ((LoopCount) * ElementSize)), Pivot) <= 0){\r
+    if (CompareFunction ((VOID *)((UINT8 *)BufferToSort + ((LoopCount) * ElementSize)), Pivot) <= 0) {\r
       //\r
       // swap\r
       //\r
-      CopyMem (BufferOneElement, (UINT8*) BufferToSort + (NextSwapLocation * ElementSize), ElementSize);\r
-      CopyMem ((UINT8*) BufferToSort + (NextSwapLocation * ElementSize), (UINT8*) BufferToSort + ((LoopCount) * ElementSize), ElementSize);\r
-      CopyMem ((UINT8*) BufferToSort + ((LoopCount)*ElementSize), BufferOneElement, ElementSize);\r
+      CopyMem (BufferOneElement, (UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), ElementSize);\r
+      CopyMem ((UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), (UINT8 *)BufferToSort + ((LoopCount) * ElementSize), ElementSize);\r
+      CopyMem ((UINT8 *)BufferToSort + ((LoopCount)*ElementSize), BufferOneElement, ElementSize);\r
 \r
       //\r
       // increment NextSwapLocation\r
@@ -83,12 +83,13 @@ QuickSort (
       NextSwapLocation++;\r
     }\r
   }\r
+\r
   //\r
   // swap pivot to it's final position (NextSwapLocation)\r
   //\r
   CopyMem (BufferOneElement, Pivot, ElementSize);\r
-  CopyMem (Pivot, (UINT8*) BufferToSort + (NextSwapLocation * ElementSize), ElementSize);\r
-  CopyMem ((UINT8*) BufferToSort + (NextSwapLocation * ElementSize), BufferOneElement, ElementSize);\r
+  CopyMem (Pivot, (UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), ElementSize);\r
+  CopyMem ((UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), BufferOneElement, ElementSize);\r
 \r
   //\r
   // Now recurse on 2 partial lists.  neither of these will have the 'pivot' element\r