]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseRngLibTimerLib/RngLibTimer.c
MdePkg: Apply uncrustify changes
[mirror_edk2.git] / MdePkg / Library / BaseRngLibTimerLib / RngLibTimer.c
index 54d29d96f3d38699c2cf393eab771098377c2b2c..980854d67b726f4ea037d80cd31edd593001b214 100644 (file)
@@ -11,7 +11,7 @@
 #include <Library/DebugLib.h>\r
 #include <Library/TimerLib.h>\r
 \r
-#define DEFAULT_DELAY_TIME_IN_MICROSECONDS 10\r
+#define DEFAULT_DELAY_TIME_IN_MICROSECONDS  10\r
 \r
 /**\r
  Using the TimerLib GetPerformanceCounterProperties() we delay\r
@@ -26,22 +26,22 @@ CalculateMinimumDecentDelayInMicroseconds (
   VOID\r
   )\r
 {\r
-  UINT64 CounterHz;\r
+  UINT64  CounterHz;\r
 \r
   // Get the counter properties\r
   CounterHz = GetPerformanceCounterProperties (NULL, NULL);\r
   // Make sure we won't divide by zero\r
   if (CounterHz == 0) {\r
-    ASSERT(CounterHz != 0); // Assert so the developer knows something is wrong\r
+    ASSERT (CounterHz != 0); // Assert so the developer knows something is wrong\r
     return DEFAULT_DELAY_TIME_IN_MICROSECONDS;\r
   }\r
+\r
   // Calculate the minimum delay based on 1.5 microseconds divided by the hertz.\r
   // We calculate the length of a cycle (1/CounterHz) and multiply it by 1.5 microseconds\r
   // This ensures that the performance counter has increased by at least one\r
-  return (UINT32)(MAX (DivU64x64Remainder (1500000,CounterHz, NULL), 1));\r
+  return (UINT32)(MAX (DivU64x64Remainder (1500000, CounterHz, NULL), 1));\r
 }\r
 \r
-\r
 /**\r
   Generates a 16-bit random number.\r
 \r
@@ -56,11 +56,11 @@ CalculateMinimumDecentDelayInMicroseconds (
 BOOLEAN\r
 EFIAPI\r
 GetRandomNumber16 (\r
-  OUT     UINT16                    *Rand\r
+  OUT     UINT16  *Rand\r
   )\r
 {\r
   UINT32  Index;\r
-  UINT8  *RandPtr;\r
+  UINT8   *RandPtr;\r
   UINT32  DelayInMicroSeconds;\r
 \r
   ASSERT (Rand != NULL);\r
@@ -68,15 +68,17 @@ GetRandomNumber16 (
   if (Rand == NULL) {\r
     return FALSE;\r
   }\r
+\r
   DelayInMicroSeconds = CalculateMinimumDecentDelayInMicroseconds ();\r
-  RandPtr = (UINT8*)Rand;\r
+  RandPtr             = (UINT8 *)Rand;\r
   // Get 2 bytes of random ish data\r
-  for (Index = 0; Index < sizeof(UINT16); Index ++) {\r
+  for (Index = 0; Index < sizeof (UINT16); Index++) {\r
     *RandPtr = (UINT8)(GetPerformanceCounter () & 0xFF);\r
     // Delay to give the performance counter a chance to change\r
     MicroSecondDelay (DelayInMicroSeconds);\r
     RandPtr++;\r
   }\r
+\r
   return TRUE;\r
 }\r
 \r
@@ -94,11 +96,11 @@ GetRandomNumber16 (
 BOOLEAN\r
 EFIAPI\r
 GetRandomNumber32 (\r
-  OUT     UINT32                    *Rand\r
+  OUT     UINT32  *Rand\r
   )\r
 {\r
   UINT32  Index;\r
-  UINT8  *RandPtr;\r
+  UINT8   *RandPtr;\r
   UINT32  DelayInMicroSeconds;\r
 \r
   ASSERT (Rand != NULL);\r
@@ -107,15 +109,16 @@ GetRandomNumber32 (
     return FALSE;\r
   }\r
 \r
-  RandPtr = (UINT8 *) Rand;\r
+  RandPtr             = (UINT8 *)Rand;\r
   DelayInMicroSeconds = CalculateMinimumDecentDelayInMicroseconds ();\r
   // Get 4 bytes of random ish data\r
-  for (Index = 0; Index < sizeof(UINT32); Index ++) {\r
+  for (Index = 0; Index < sizeof (UINT32); Index++) {\r
     *RandPtr = (UINT8)(GetPerformanceCounter () & 0xFF);\r
     // Delay to give the performance counter a chance to change\r
     MicroSecondDelay (DelayInMicroSeconds);\r
     RandPtr++;\r
   }\r
+\r
   return TRUE;\r
 }\r
 \r
@@ -133,11 +136,11 @@ GetRandomNumber32 (
 BOOLEAN\r
 EFIAPI\r
 GetRandomNumber64 (\r
-  OUT     UINT64                    *Rand\r
+  OUT     UINT64  *Rand\r
   )\r
 {\r
   UINT32  Index;\r
-  UINT8  *RandPtr;\r
+  UINT8   *RandPtr;\r
   UINT32  DelayInMicroSeconds;\r
 \r
   ASSERT (Rand != NULL);\r
@@ -146,10 +149,10 @@ GetRandomNumber64 (
     return FALSE;\r
   }\r
 \r
-  RandPtr = (UINT8 *)Rand;\r
+  RandPtr             = (UINT8 *)Rand;\r
   DelayInMicroSeconds = CalculateMinimumDecentDelayInMicroseconds ();\r
   // Get 8 bytes of random ish data\r
-  for (Index = 0; Index < sizeof(UINT64); Index ++) {\r
+  for (Index = 0; Index < sizeof (UINT64); Index++) {\r
     *RandPtr = (UINT8)(GetPerformanceCounter () & 0xFF);\r
     // Delay to give the performance counter a chance to change\r
     MicroSecondDelay (DelayInMicroSeconds);\r
@@ -173,7 +176,7 @@ GetRandomNumber64 (
 BOOLEAN\r
 EFIAPI\r
 GetRandomNumber128 (\r
-  OUT     UINT64                    *Rand\r
+  OUT     UINT64  *Rand\r
   )\r
 {\r
   ASSERT (Rand != NULL);\r