提交 be4f601d 编写于 作者: D Download-Fritz

OcGuardLib: Use STATIC_ASSERT over typedef hacks

上级 469cc6ef
......@@ -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) (
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册