mirror of
https://github.com/acidanthera/OpenCorePkg.git
synced 2025-12-08 19:25:01 +00:00
OcGuardLib: Use STATIC_ASSERT over typedef hacks
This commit is contained in:
parent
469cc6ef33
commit
be4f601d9e
@ -16,19 +16,24 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include <Base.h>
|
||||
|
||||
#include <Library/OcGuardLib.h>
|
||||
|
||||
//
|
||||
// Currently no architectures provide UINTN and INTN different from 32-bit or 64-bit
|
||||
// integers. For this reason they are the only variants supported and are enforced here.
|
||||
// The lib must be C99-compliant, thus no _Static_assert.
|
||||
//
|
||||
|
||||
typedef BOOLEAN SignedIntnMustBe32or64[sizeof (INTN) == sizeof (INT64)
|
||||
|| sizeof (INTN) == sizeof (INT32) ? 1 : -1];
|
||||
STATIC_ASSERT (
|
||||
sizeof (INTN) == sizeof (INT64) || sizeof (INTN) == sizeof (INT32),
|
||||
"INTN must be 32 or 64 Bits wide."
|
||||
);
|
||||
|
||||
typedef BOOLEAN UnsignedIntnMustBe32or64[sizeof (UINTN) == sizeof (UINT64)
|
||||
|| sizeof (UINTN) == sizeof (UINT32) ? 1 : -1];
|
||||
STATIC_ASSERT (
|
||||
sizeof (UINTN) == sizeof (UINT64) || sizeof (UINTN) == sizeof (UINT32),
|
||||
"UINTN must be 32 or 64 Bits wide."
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
(OcOverflowAddUN) (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user