MdePkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the MdePkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
committed by
mergify[bot]
parent
1436aea4d5
commit
2f88bd3a12
@@ -11,7 +11,7 @@
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/TimerLib.h>
|
||||
|
||||
#define DEFAULT_DELAY_TIME_IN_MICROSECONDS 10
|
||||
#define DEFAULT_DELAY_TIME_IN_MICROSECONDS 10
|
||||
|
||||
/**
|
||||
Using the TimerLib GetPerformanceCounterProperties() we delay
|
||||
@@ -26,22 +26,22 @@ CalculateMinimumDecentDelayInMicroseconds (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
UINT64 CounterHz;
|
||||
UINT64 CounterHz;
|
||||
|
||||
// Get the counter properties
|
||||
CounterHz = GetPerformanceCounterProperties (NULL, NULL);
|
||||
// Make sure we won't divide by zero
|
||||
if (CounterHz == 0) {
|
||||
ASSERT(CounterHz != 0); // Assert so the developer knows something is wrong
|
||||
ASSERT (CounterHz != 0); // Assert so the developer knows something is wrong
|
||||
return DEFAULT_DELAY_TIME_IN_MICROSECONDS;
|
||||
}
|
||||
|
||||
// Calculate the minimum delay based on 1.5 microseconds divided by the hertz.
|
||||
// We calculate the length of a cycle (1/CounterHz) and multiply it by 1.5 microseconds
|
||||
// This ensures that the performance counter has increased by at least one
|
||||
return (UINT32)(MAX (DivU64x64Remainder (1500000,CounterHz, NULL), 1));
|
||||
return (UINT32)(MAX (DivU64x64Remainder (1500000, CounterHz, NULL), 1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Generates a 16-bit random number.
|
||||
|
||||
@@ -56,11 +56,11 @@ CalculateMinimumDecentDelayInMicroseconds (
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
GetRandomNumber16 (
|
||||
OUT UINT16 *Rand
|
||||
OUT UINT16 *Rand
|
||||
)
|
||||
{
|
||||
UINT32 Index;
|
||||
UINT8 *RandPtr;
|
||||
UINT8 *RandPtr;
|
||||
UINT32 DelayInMicroSeconds;
|
||||
|
||||
ASSERT (Rand != NULL);
|
||||
@@ -68,15 +68,17 @@ GetRandomNumber16 (
|
||||
if (Rand == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DelayInMicroSeconds = CalculateMinimumDecentDelayInMicroseconds ();
|
||||
RandPtr = (UINT8*)Rand;
|
||||
RandPtr = (UINT8 *)Rand;
|
||||
// Get 2 bytes of random ish data
|
||||
for (Index = 0; Index < sizeof(UINT16); Index ++) {
|
||||
for (Index = 0; Index < sizeof (UINT16); Index++) {
|
||||
*RandPtr = (UINT8)(GetPerformanceCounter () & 0xFF);
|
||||
// Delay to give the performance counter a chance to change
|
||||
MicroSecondDelay (DelayInMicroSeconds);
|
||||
RandPtr++;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -94,11 +96,11 @@ GetRandomNumber16 (
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
GetRandomNumber32 (
|
||||
OUT UINT32 *Rand
|
||||
OUT UINT32 *Rand
|
||||
)
|
||||
{
|
||||
UINT32 Index;
|
||||
UINT8 *RandPtr;
|
||||
UINT8 *RandPtr;
|
||||
UINT32 DelayInMicroSeconds;
|
||||
|
||||
ASSERT (Rand != NULL);
|
||||
@@ -107,15 +109,16 @@ GetRandomNumber32 (
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
RandPtr = (UINT8 *) Rand;
|
||||
RandPtr = (UINT8 *)Rand;
|
||||
DelayInMicroSeconds = CalculateMinimumDecentDelayInMicroseconds ();
|
||||
// Get 4 bytes of random ish data
|
||||
for (Index = 0; Index < sizeof(UINT32); Index ++) {
|
||||
for (Index = 0; Index < sizeof (UINT32); Index++) {
|
||||
*RandPtr = (UINT8)(GetPerformanceCounter () & 0xFF);
|
||||
// Delay to give the performance counter a chance to change
|
||||
MicroSecondDelay (DelayInMicroSeconds);
|
||||
RandPtr++;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -133,11 +136,11 @@ GetRandomNumber32 (
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
GetRandomNumber64 (
|
||||
OUT UINT64 *Rand
|
||||
OUT UINT64 *Rand
|
||||
)
|
||||
{
|
||||
UINT32 Index;
|
||||
UINT8 *RandPtr;
|
||||
UINT8 *RandPtr;
|
||||
UINT32 DelayInMicroSeconds;
|
||||
|
||||
ASSERT (Rand != NULL);
|
||||
@@ -146,10 +149,10 @@ GetRandomNumber64 (
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
RandPtr = (UINT8 *)Rand;
|
||||
RandPtr = (UINT8 *)Rand;
|
||||
DelayInMicroSeconds = CalculateMinimumDecentDelayInMicroseconds ();
|
||||
// Get 8 bytes of random ish data
|
||||
for (Index = 0; Index < sizeof(UINT64); Index ++) {
|
||||
for (Index = 0; Index < sizeof (UINT64); Index++) {
|
||||
*RandPtr = (UINT8)(GetPerformanceCounter () & 0xFF);
|
||||
// Delay to give the performance counter a chance to change
|
||||
MicroSecondDelay (DelayInMicroSeconds);
|
||||
@@ -173,7 +176,7 @@ GetRandomNumber64 (
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
GetRandomNumber128 (
|
||||
OUT UINT64 *Rand
|
||||
OUT UINT64 *Rand
|
||||
)
|
||||
{
|
||||
ASSERT (Rand != NULL);
|
||||
|
Reference in New Issue
Block a user