public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [staging/edk2-test Patch 0/2] MdePkgUnitTest: Add unit test package for MdePkg
@ 2017-12-20  0:16 Kinney, Michael D
  2017-12-20  0:16 ` [staging/edk2-test Patch 1/2] " Kinney, Michael D
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Kinney, Michael D @ 2017-12-20  0:16 UTC (permalink / raw)
  To: edk2-devel; +Cc: Sean Brogan, Liming Gao, Michael D Kinney

Initial version of a unit test package for the MdePkg that
uses services from the MsUnitTestPkg to implement test cases
for the SafeIntLib in the MdePkg.

The initial version of these tests is from the following
branch and commit:

https://github.com/Microsoft/MS_UEFI/tree/share/intsafelib/MdeModulePkg/UnitTests/IntSafeLib
https://github.com/Microsoft/MS_UEFI/commit/cc2e9d229d4e876ab64d75dee16761a297582fd9

Additional updates for CPU compatibility, CHAR8 signed/unsigned, 
and EDK II code style issues.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>

Kinney, Michael D (1):
  MdePkgUnitTest: Fix EDK II style issues

Michael D Kinney (1):
  MdePkgUnitTest: Add unit test package for MdePkg

 MdePkgUnitTest/MdePkgUnitTest.dec                  |   20 +
 MdePkgUnitTest/MdePkgUnitTest.dsc                  |   57 +
 .../SafeIntLib/SafeIntLibUintnIntnUnitTests32.c    |   54 +
 .../SafeIntLib/SafeIntLibUintnIntnUnitTests64.c    |   54 +
 .../SafeIntLib/SafeIntLibUintnIntnUnitTestsEbc.c   |   65 +
 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.c    | 3667 ++++++++++++++++++++
 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.h    |  155 +
 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.inf  |   69 +
 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests32.c  |  635 ++++
 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests64.c  |  639 ++++
 10 files changed, 5415 insertions(+)
 create mode 100644 MdePkgUnitTest/MdePkgUnitTest.dec
 create mode 100644 MdePkgUnitTest/MdePkgUnitTest.dsc
 create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTests32.c
 create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTests64.c
 create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTestsEbc.c
 create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.c
 create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.h
 create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.inf
 create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests32.c
 create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests64.c

-- 
2.14.2.windows.3



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [staging/edk2-test Patch 1/2] MdePkgUnitTest: Add unit test package for MdePkg
  2017-12-20  0:16 [staging/edk2-test Patch 0/2] MdePkgUnitTest: Add unit test package for MdePkg Kinney, Michael D
@ 2017-12-20  0:16 ` Kinney, Michael D
  2017-12-20  0:16 ` [staging/edk2-test Patch 2/2] MdePkgUnitTest: Fix EDK II style issues Kinney, Michael D
  2018-01-18  8:09 ` [staging/edk2-test Patch 0/2] MdePkgUnitTest: Add unit test package for MdePkg Sean Brogan
  2 siblings, 0 replies; 4+ messages in thread
From: Kinney, Michael D @ 2017-12-20  0:16 UTC (permalink / raw)
  To: edk2-devel; +Cc: Michael D Kinney, Sean Brogan, Liming Gao

From: Michael D Kinney <michael.d.kinney@intel.com>

Initial version of a unit test package for the MdePkg that
uses services from the MsUnitTestPkg to implement test cases
for the SafeIntLib in the MdePkg.

The initial version of these tests is from the following
branch and commit:

https://github.com/Microsoft/MS_UEFI/tree/share/intsafelib/MdeModulePkg/UnitTests/IntSafeLib
https://github.com/Microsoft/MS_UEFI/commit/cc2e9d229d4e876ab64d75dee16761a297582fd9

Updates from original content:
* Update test cases to be compatible with all supported CPU types
* Add unit test cases to verify that Result is set to the correct
  error value when RETURN_BUFFER_TOO_SMALL is returned to indicate
  an overflow or an undeflow condition.
* Add unit test cases to pass in a Result parameter of NULL and
  verify that RETURN_INVALID_PARAMETER is returned.
* Add SafeChar8Add() unit tests
* Add SafeChar8Sub() unit tests
* Add SafeChar8Mult() unit tests
* Add SafeInt8ToChar8() unit tests
* Update ToChar8() unit tests to perform success tests
  on positive values in range 0..127 and failure tests
  in ranges -128..-1 and 128..255.
* Replace "UIntN" with "Uintn"
* Replace "IntN" with "Intn"
* Replace "UIntxx" with "Uintxx"
* Fix EDK II code style issues

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 MdePkgUnitTest/MdePkgUnitTest.dec                  |   20 +
 MdePkgUnitTest/MdePkgUnitTest.dsc                  |   57 +
 .../SafeIntLib/SafeIntLibUintnIntnUnitTests32.c    |   54 +
 .../SafeIntLib/SafeIntLibUintnIntnUnitTests64.c    |   54 +
 .../SafeIntLib/SafeIntLibUintnIntnUnitTestsEbc.c   |   65 +
 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.c    | 3450 ++++++++++++++++++++
 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.h    |  155 +
 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.inf  |   69 +
 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests32.c  |  595 ++++
 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests64.c  |  599 ++++
 10 files changed, 5118 insertions(+)
 create mode 100644 MdePkgUnitTest/MdePkgUnitTest.dec
 create mode 100644 MdePkgUnitTest/MdePkgUnitTest.dsc
 create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTests32.c
 create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTests64.c
 create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTestsEbc.c
 create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.c
 create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.h
 create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.inf
 create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests32.c
 create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests64.c

diff --git a/MdePkgUnitTest/MdePkgUnitTest.dec b/MdePkgUnitTest/MdePkgUnitTest.dec
new file mode 100644
index 0000000000..9ea59192fb
--- /dev/null
+++ b/MdePkgUnitTest/MdePkgUnitTest.dec
@@ -0,0 +1,20 @@
+## @file
+# This Package provides unit tests for the MdePkg
+#
+# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+#
+# This program and the accompanying materials are licensed and made available under
+# the terms and conditions of the BSD License which accompanies this distribution.
+# The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##
+
+[Defines]
+  DEC_SPECIFICATION = 0x00010005
+  PACKAGE_NAME      = MdePkgUnitTest
+  PACKAGE_GUID      = 42038d8f-d911-11e7-a7f4-f8597177a00a
+  PACKAGE_VERSION   = 0.1
diff --git a/MdePkgUnitTest/MdePkgUnitTest.dsc b/MdePkgUnitTest/MdePkgUnitTest.dsc
new file mode 100644
index 0000000000..d98483020b
--- /dev/null
+++ b/MdePkgUnitTest/MdePkgUnitTest.dsc
@@ -0,0 +1,57 @@
+## @file
+# This Package provides unit tests for the MdePkg
+#
+# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+#
+# This program and the accompanying materials are licensed and made available under
+# the terms and conditions of the BSD License which accompanies this distribution.
+# The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##
+
+[Defines]
+  PLATFORM_NAME                  = MdePkgUnitTest
+  PLATFORM_GUID                  = 44be67cf-d911-11e7-bf44-f8597177a00a
+  PLATFORM_VERSION               = 0.1
+  DSC_SPECIFICATION              = 0x00010005
+  OUTPUT_DIRECTORY               = Build/MdePkgUnitTest
+  SUPPORTED_ARCHITECTURES        = IA32|IPF|X64|EBC|ARM|AARCH64
+  BUILD_TARGETS                  = DEBUG|RELEASE
+  SKUID_IDENTIFIER               = DEFAULT
+
+[LibraryClasses]
+  UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
+  UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+  UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+  UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
+  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+  DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+  BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+  BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+  PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+  DebugLib|MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf
+  DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
+  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+
+  UnitTestLib|MsUnitTestPkg/Library/UnitTestLib/UnitTestLib.inf
+  UnitTestAssertLib|MsUnitTestPkg/Library/UnitTestAssertLib/UnitTestAssertLib.inf
+  UnitTestLogLib|MsUnitTestPkg/Library/UnitTestLogLib/UnitTestLogLib.inf
+  UnitTestPersistenceLib|MsUnitTestPkg/Library/UnitTestPersistenceFileSystemLib/UnitTestPersistenceFileSystemLib.inf
+  UnitTestBootUsbLib|MsUnitTestPkg/Library/UnitTestBootUsbMicrosoftLib/UnitTestBootUsbMicrosoftLib.inf
+  UnitTestResultReportLib|MsUnitTestPkg/Library/UnitTestResultReportPlainTextOutputLib/UnitTestResultReportLib.inf
+
+  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
+  FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
+  HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
+  UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
+  SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
+
+[Components]
+  MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.inf {
+    <LibraryClasses>
+      SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
+  }
diff --git a/MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTests32.c b/MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTests32.c
new file mode 100644
index 0000000000..632ddbbfef
--- /dev/null
+++ b/MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTests32.c
@@ -0,0 +1,54 @@
+/** @file
+
+  32-bit specific functions for unit-testing INTN and UINTN functions in
+  SafeIntLib.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php.
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "SafeIntLibUnitTests.h"
+
+#define _UNIT_TEST_32_BIT(CaseName) \
+UNIT_TEST_STATUS \
+EFIAPI \
+CaseName##_32 ( \
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework, \
+  IN UNIT_TEST_CONTEXT           Context \
+  ); \
+\
+UNIT_TEST_STATUS \
+EFIAPI \
+CaseName ( \
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework, \
+  IN UNIT_TEST_CONTEXT           Context \
+  ) \
+{ \
+  return CaseName##_32(Framework, Context); \
+}
+
+_UNIT_TEST_32_BIT(TestSafeInt32ToUintn)
+_UNIT_TEST_32_BIT(TestSafeUint32ToIntn)
+_UNIT_TEST_32_BIT(TestSafeIntnToInt32)
+_UNIT_TEST_32_BIT(TestSafeIntnToUint32)
+_UNIT_TEST_32_BIT(TestSafeUintnToUint32)
+_UNIT_TEST_32_BIT(TestSafeUintnToIntn)
+_UNIT_TEST_32_BIT(TestSafeUintnToInt64)
+_UNIT_TEST_32_BIT(TestSafeInt64ToIntn)
+_UNIT_TEST_32_BIT(TestSafeInt64ToUintn)
+_UNIT_TEST_32_BIT(TestSafeUint64ToIntn)
+_UNIT_TEST_32_BIT(TestSafeUint64ToUintn)
+_UNIT_TEST_32_BIT(TestSafeUintnAdd)
+_UNIT_TEST_32_BIT(TestSafeIntnAdd)
+_UNIT_TEST_32_BIT(TestSafeUintnSub)
+_UNIT_TEST_32_BIT(TestSafeIntnSub)
+_UNIT_TEST_32_BIT(TestSafeUintnMult)
+_UNIT_TEST_32_BIT(TestSafeIntnMult)
diff --git a/MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTests64.c b/MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTests64.c
new file mode 100644
index 0000000000..462f93e351
--- /dev/null
+++ b/MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTests64.c
@@ -0,0 +1,54 @@
+/** @file
+
+  64-bit specific functions for unit-testing INTN and UINTN functions in
+  SafeIntLib.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php.
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "SafeIntLibUnitTests.h"
+
+#define _UNIT_TEST_64_BIT(CaseName) \
+UNIT_TEST_STATUS \
+EFIAPI \
+CaseName##_64 ( \
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework, \
+  IN UNIT_TEST_CONTEXT           Context \
+  ); \
+\
+UNIT_TEST_STATUS \
+EFIAPI \
+CaseName ( \
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework, \
+  IN UNIT_TEST_CONTEXT           Context \
+  ) \
+{ \
+  return CaseName##_64(Framework, Context); \
+}
+
+_UNIT_TEST_64_BIT(TestSafeInt32ToUintn)
+_UNIT_TEST_64_BIT(TestSafeUint32ToIntn)
+_UNIT_TEST_64_BIT(TestSafeIntnToInt32)
+_UNIT_TEST_64_BIT(TestSafeIntnToUint32)
+_UNIT_TEST_64_BIT(TestSafeUintnToUint32)
+_UNIT_TEST_64_BIT(TestSafeUintnToIntn)
+_UNIT_TEST_64_BIT(TestSafeUintnToInt64)
+_UNIT_TEST_64_BIT(TestSafeInt64ToIntn)
+_UNIT_TEST_64_BIT(TestSafeInt64ToUintn)
+_UNIT_TEST_64_BIT(TestSafeUint64ToIntn)
+_UNIT_TEST_64_BIT(TestSafeUint64ToUintn)
+_UNIT_TEST_64_BIT(TestSafeUintnAdd)
+_UNIT_TEST_64_BIT(TestSafeIntnAdd)
+_UNIT_TEST_64_BIT(TestSafeUintnSub)
+_UNIT_TEST_64_BIT(TestSafeIntnSub)
+_UNIT_TEST_64_BIT(TestSafeUintnMult)
+_UNIT_TEST_64_BIT(TestSafeIntnMult)
diff --git a/MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTestsEbc.c b/MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTestsEbc.c
new file mode 100644
index 0000000000..e91811bc2f
--- /dev/null
+++ b/MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTestsEbc.c
@@ -0,0 +1,65 @@
+/** @file
+
+  EBC-specific functions for unit-testing INTN and UINTN functions in
+  SafeIntLib.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php.
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "SafeIntLibUnitTests.h"
+
+#define _EBC_UNIT_TEST(CaseName) \
+UNIT_TEST_STATUS \
+EFIAPI \
+CaseName##_32 ( \
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework, \
+  IN UNIT_TEST_CONTEXT           Context \
+  ); \
+\
+UNIT_TEST_STATUS \
+EFIAPI \
+CaseName##_64 ( \
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework, \
+  IN UNIT_TEST_CONTEXT           Context \
+  ); \
+\
+UNIT_TEST_STATUS \
+EFIAPI \
+CaseName ( \
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework, \
+  IN UNIT_TEST_CONTEXT           Context \
+  ) \
+{ \
+  if (sizeof (UINTN) == sizeof (UINT32)) { \
+    return CaseName##_32(Framework, Context); \
+  } else { \
+    return CaseName##_64(Framework, Context); \
+  } \
+}
+
+_EBC_UNIT_TEST(TestSafeInt32ToUintn)
+_EBC_UNIT_TEST(TestSafeUint32ToIntn)
+_EBC_UNIT_TEST(TestSafeIntnToInt32)
+_EBC_UNIT_TEST(TestSafeIntnToUint32)
+_EBC_UNIT_TEST(TestSafeUintnToUint32)
+_EBC_UNIT_TEST(TestSafeUintnToIntn)
+_EBC_UNIT_TEST(TestSafeUintnToInt64)
+_EBC_UNIT_TEST(TestSafeInt64ToIntn)
+_EBC_UNIT_TEST(TestSafeInt64ToUintn)
+_EBC_UNIT_TEST(TestSafeUint64ToIntn)
+_EBC_UNIT_TEST(TestSafeUint64ToUintn)
+_EBC_UNIT_TEST(TestSafeUintnAdd)
+_EBC_UNIT_TEST(TestSafeIntnAdd)
+_EBC_UNIT_TEST(TestSafeUintnSub)
+_EBC_UNIT_TEST(TestSafeIntnSub)
+_EBC_UNIT_TEST(TestSafeUintnMult)
+_EBC_UNIT_TEST(TestSafeIntnMult)
diff --git a/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.c b/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.c
new file mode 100644
index 0000000000..475c10c728
--- /dev/null
+++ b/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.c
@@ -0,0 +1,3450 @@
+/** @file
+  UEFI Shell based application for unit testing the SafeIntLib.
+
+  Copyright (c) 2017, Microsoft Corporation
+
+  All rights reserved.
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions are met:
+  1. Redistributions of source code must retain the above copyright notice,
+  this list of conditions and the following disclaimer.
+  2. Redistributions in binary form must reproduce the above copyright notice,
+  this list of conditions and the following disclaimer in the documentation
+  and/or other materials provided with the distribution.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+**/
+
+#include "SafeIntLibUnitTests.h"
+
+#define UNIT_TEST_APP_NAME        L"Int Safe Lib Unit Test Application"
+#define UNIT_TEST_APP_VERSION     L"0.1"
+
+//
+// Conversion function tests:
+//
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt8ToUint8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT8 Operand = 0x5b;
+  UINT8 Result = 0;
+
+  //
+  // Positive UINT8 should result in just a cast
+  //
+  Status = SafeInt8ToUint8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  //
+  // Negative number should result in an error status
+  //
+  Operand = (-56);
+  Status = SafeInt8ToUint8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+
+  Status = SafeInt8ToUint8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt8ToChar8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT8 Operand = 0x5b;
+  CHAR8 Result = 0;
+
+  //
+  // Positive INT8 should result in just a cast
+  //
+  Status = SafeInt8ToChar8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  //
+  // Negative number should result in an error status
+  //
+  Operand = (-56);
+  Status = SafeInt8ToChar8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Status = SafeInt8ToChar8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt8ToUint16 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT8 Operand = 0x5b;
+  UINT16 Result = 0;
+
+  //
+  // Positive UINT8 should result in just a cast
+  //
+  Status = SafeInt8ToUint16(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  //
+  // Negative number should result in an error status
+  //
+  Operand = (-56);
+  Status = SafeInt8ToUint16(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+
+  Status = SafeInt8ToUint16(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt8ToUint32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT8 Operand = 0x5b;
+  UINT32 Result = 0;
+
+  //
+  // Positive UINT8 should result in just a cast
+  //
+  Status = SafeInt8ToUint32(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  //
+  // Negative number should result in an error status
+  //
+  Operand = (-56);
+  Status = SafeInt8ToUint32(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+
+  Status = SafeInt8ToUint32(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt8ToUintn (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT8 Operand = 0x5b;
+  UINTN Result = 0;
+
+  //
+  // Positive UINT8 should result in just a cast
+  //
+  Status = SafeInt8ToUintn(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  //
+  // Negative number should result in an error status
+  //
+  Operand = (-56);
+  Status = SafeInt8ToUintn(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+
+  Status = SafeInt8ToUintn(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt8ToUint64 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT8 Operand = 0x5b;
+  UINT64 Result = 0;
+
+  //
+  // Positive UINT8 should result in just a cast
+  //
+  Status = SafeInt8ToUint64(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  //
+  // Negative number should result in an error status
+  //
+  Operand = (-56);
+  Status = SafeInt8ToUint64(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT64_ERROR, Result);
+
+  Status = SafeInt8ToUint64(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint8ToInt8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT8 Operand = 0x5b;
+  INT8 Result = 0;
+
+  //
+  // Operand <= 0x7F (MAX_INT8) should result in a cast
+  //
+  Status = SafeUint8ToInt8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  //
+  // Operand larger than 0x7f should result in an error status
+  //
+  Operand = 0xaf;
+  Status = SafeUint8ToInt8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+
+  Status = SafeUint8ToInt8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint8ToChar8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT8 Operand = 0x5b;
+  CHAR8 Result = 0;
+
+  //
+  // CHAR8 is typedefed as char, which by default is signed, but is
+  // also allowed to be unsigned.
+  //
+
+  //
+  // Operand <= 0x7F (MAX_INT8) should result in a cast
+  //
+  Status = SafeUint8ToChar8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  //
+  // Operand larger than 0x7f should result in an error status
+  //
+  Operand = 0xaf;
+  Status = SafeUint8ToChar8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Status = SafeUint8ToChar8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt16ToInt8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT16 Operand = 0x5b;
+  INT8 Result = 0;
+
+  //
+  // If Operand is between MIN_INT8 and MAX_INT8 inclusive, then it's a cast
+  //
+  Status = SafeInt16ToInt8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  Operand = (-35);
+  Status = SafeInt16ToInt8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL((-35), Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = 0x1234;
+  Status = SafeInt16ToInt8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+
+  Operand = (-17835);
+  Status = SafeInt16ToInt8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+
+  Status = SafeInt16ToInt8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt16ToChar8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT16 Operand = 0x5b;
+  CHAR8 Result = 0;
+
+  //
+  // CHAR8 is typedefed as char, which by default is signed, but is
+  // also allowed to be unsigned.
+  //
+
+  //
+  // If Operand is between MIN_INT8 and MAX_INT8 inclusive, then it's a cast
+  //
+  Status = SafeInt16ToChar8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (-35);
+  Status = SafeInt16ToChar8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Operand = 0x1234;
+  Status = SafeInt16ToChar8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Operand = (-17835);
+  Status = SafeInt16ToChar8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Status = SafeInt16ToChar8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt16ToUint8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT16 Operand = 0x5b;
+  UINT8 Result = 0;
+
+  //
+  // If Operand is between 0 and MAX_INT8 inclusive, then it's a cast
+  //
+  Status = SafeInt16ToUint8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = 0x1234;
+  Status = SafeInt16ToUint8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+
+  Operand = (-17835);
+  Status = SafeInt16ToUint8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+
+  Status = SafeInt16ToUint8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt16ToUint16 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT16 Operand = 0x5b5b;
+  UINT16 Result = 0;
+
+  //
+  // If Operand is non-negative, then it's a cast
+  //
+  Status = SafeInt16ToUint16(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b5b, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (-17835);
+  Status = SafeInt16ToUint16(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+
+  Status = SafeInt16ToUint16(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt16ToUint32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT16 Operand = 0x5b5b;
+  UINT32 Result = 0;
+
+  //
+  // If Operand is non-negative, then it's a cast
+  //
+  Status = SafeInt16ToUint32(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b5b, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (-17835);
+  Status = SafeInt16ToUint32(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+
+  Status = SafeInt16ToUint32(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt16ToUintn (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT16 Operand = 0x5b5b;
+  UINTN Result = 0;
+
+  //
+  // If Operand is non-negative, then it's a cast
+  //
+  Status = SafeInt16ToUintn(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b5b, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (-17835);
+  Status = SafeInt16ToUintn(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+
+  Status = SafeInt16ToUintn(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt16ToUint64 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT16 Operand = 0x5b5b;
+  UINT64 Result = 0;
+
+  //
+  // If Operand is non-negative, then it's a cast
+  //
+  Status = SafeInt16ToUint64(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b5b, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (-17835);
+  Status = SafeInt16ToUint64(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT64_ERROR, Result);
+
+  Status = SafeInt16ToUint64(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint16ToInt8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT16 Operand = 0x5b;
+  INT8 Result = 0;
+
+  //
+  // If Operand is <= MAX_INT8, it's a cast
+  //
+  Status = SafeUint16ToInt8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0x5b5b);
+  Status = SafeUint16ToInt8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+
+  Status = SafeUint16ToInt8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint16ToChar8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT16 Operand = 0x5b;
+  CHAR8 Result = 0;
+
+  // CHAR8 is typedefed as char, which by default is signed, but is
+  // also allowed to be unsigned.
+
+  //
+  // If Operand is <= MAX_INT8, it's a cast
+  //
+  Status = SafeUint16ToChar8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0x5b5b);
+  Status = SafeUint16ToChar8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Status = SafeUint16ToChar8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint16ToUint8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT16 Operand = 0xab;
+  UINT8 Result = 0;
+
+  //
+  // If Operand is <= MAX_UINT8 (0xff), it's a cast
+  //
+  Status = SafeUint16ToUint8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0x5b5b);
+  Status = SafeUint16ToUint8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+
+  Status = SafeUint16ToUint8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint16ToInt16 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT16 Operand = 0x5b5b;
+  INT16 Result = 0;
+
+  //
+  // If Operand is <= MAX_INT16 (0x7fff), it's a cast
+  //
+  Status = SafeUint16ToInt16(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b5b, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xabab);
+  Status = SafeUint16ToInt16(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+
+  Status = SafeUint16ToInt16(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt32ToInt8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT32 Operand = 0x5b;
+  INT8 Result = 0;
+
+  //
+  // If Operand is between MIN_INT8 and MAX_INT8 inclusive, then it's a cast
+  //
+  Status = SafeInt32ToInt8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  Operand = (-57);
+  Status = SafeInt32ToInt8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL((-57), Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0x5bababab);
+  Status = SafeInt32ToInt8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+
+  Operand = (-1537977259);
+  Status = SafeInt32ToInt8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+
+  Status = SafeInt32ToInt8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt32ToChar8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT32 Operand = 0x5b;
+  CHAR8 Result = 0;
+
+  // CHAR8 is typedefed as char, which by default is signed, but is
+  // also allowed to be unsigned.
+
+  //
+  // If Operand is between MIN_INT8 and MAX_INT8 inclusive, then it's a cast
+  //
+  Status = SafeInt32ToChar8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (-57);
+  Status = SafeInt32ToChar8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Operand = (0x5bababab);
+  Status = SafeInt32ToChar8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Operand = (-1537977259);
+  Status = SafeInt32ToChar8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Status = SafeInt32ToChar8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt32ToUint8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT32 Operand = 0x5b;
+  UINT8 Result = 0;
+
+  //
+  // If Operand is between 0 and MAX_INT8 inclusive, then it's a cast
+  //
+  Status = SafeInt32ToUint8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (-57);
+  Status = SafeInt32ToUint8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+
+  Operand = (0x5bababab);
+  Status = SafeInt32ToUint8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+
+  Operand = (-1537977259);
+  Status = SafeInt32ToUint8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+
+  Status = SafeInt32ToUint8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt32ToInt16 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT32 Operand = 0x5b5b;
+  INT16 Result = 0;
+
+  //
+  // If Operand is between MIN_INT16 and MAX_INT16 inclusive, then it's a cast
+  //
+  Status = SafeInt32ToInt16(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b5b, Result);
+
+  Operand = (-17857);
+  Status = SafeInt32ToInt16(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL((-17857), Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0x5bababab);
+  Status = SafeInt32ToInt16(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+
+  Operand = (-1537977259);
+  Status = SafeInt32ToInt16(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+
+  Status = SafeInt32ToInt16(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt32ToUint16 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT32 Operand = 0xabab;
+  UINT16 Result = 0;
+
+  //
+  // If Operand is between 0 and MAX_UINT16 inclusive, then it's a cast
+  //
+  Status = SafeInt32ToUint16(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xabab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (-17857);
+  Status = SafeInt32ToUint16(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+
+  Operand = (0x5bababab);
+  Status = SafeInt32ToUint16(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+
+  Operand = (-1537977259);
+  Status = SafeInt32ToUint16(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+
+  Status = SafeInt32ToUint16(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt32ToUint32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT32 Operand = 0x5bababab;
+  UINT32 Result = 0;
+
+  //
+  // If Operand is non-negative, then it's a cast
+  //
+  Status = SafeInt32ToUint32(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5bababab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (-1537977259);
+  Status = SafeInt32ToUint32(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+
+  Status = SafeInt32ToUint32(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt32ToUint64 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT32 Operand = 0x5bababab;
+  UINT64 Result = 0;
+
+  //
+  // If Operand is non-negative, then it's a cast
+  //
+  Status = SafeInt32ToUint64(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5bababab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (-1537977259);
+  Status = SafeInt32ToUint64(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT64_ERROR, Result);
+
+  Status = SafeInt32ToUint64(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint32ToInt8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT32 Operand = 0x5b;
+  INT8 Result = 0;
+
+  //
+  // If Operand is <= MAX_INT8, then it's a cast
+  //
+  Status = SafeUint32ToInt8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0x5bababab);
+  Status = SafeUint32ToInt8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+
+  Status = SafeUint32ToInt8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint32ToChar8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT32 Operand = 0x5b;
+  CHAR8 Result = 0;
+
+  // CHAR8 is typedefed as char, which by default is signed, but is
+  // also allowed to be unsigned.
+
+  //
+  // If Operand is <= MAX_INT8, then it's a cast
+  //
+  Status = SafeUint32ToChar8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0x5bababab);
+  Status = SafeUint32ToChar8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Status = SafeUint32ToChar8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint32ToUint8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT32 Operand = 0xab;
+  UINT8 Result = 0;
+
+  //
+  // If Operand is <= MAX_UINT8, then it's a cast
+  //
+  Status = SafeUint32ToUint8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xabababab);
+  Status = SafeUint32ToUint8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+
+  Status = SafeUint32ToUint8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint32ToInt16 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT32 Operand = 0x5bab;
+  INT16 Result = 0;
+
+  //
+  // If Operand is <= MAX_INT16, then it's a cast
+  //
+  Status = SafeUint32ToInt16(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5bab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xabababab);
+  Status = SafeUint32ToInt16(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+
+  Status = SafeUint32ToInt16(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint32ToUint16 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT32 Operand = 0xabab;
+  UINT16 Result = 0;
+
+  //
+  // If Operand is <= MAX_UINT16, then it's a cast
+  //
+  Status = SafeUint32ToUint16(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xabab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xabababab);
+  Status = SafeUint32ToUint16(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+
+  Status = SafeUint32ToUint16(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint32ToInt32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT32 Operand = 0x5bababab;
+  INT32 Result = 0;
+
+  //
+  // If Operand is <= MAX_INT32, then it's a cast
+  //
+  Status = SafeUint32ToInt32(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5bababab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xabababab);
+  Status = SafeUint32ToInt32(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+
+  Status = SafeUint32ToInt32(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeIntnToInt8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INTN Operand = 0x5b;
+  INT8 Result = 0;
+
+  //
+  // If Operand is between MIN_INT8 and MAX_INT8 inclusive, then it's a cast
+  //
+  Status = SafeIntnToInt8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  Operand = (-53);
+  Status = SafeIntnToInt8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL((-53), Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0x5bababab);
+  Status = SafeIntnToInt8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+
+  Operand = (-1537977259);
+  Status = SafeIntnToInt8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+
+  Status = SafeIntnToInt8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeIntnToChar8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INTN Operand = 0x5b;
+  CHAR8 Result = 0;
+
+  // CHAR8 is typedefed as char, which by default is signed, but is
+  // also allowed to be unsigned.
+
+  //
+  // If Operand is between MIN_INT8 and MAX_INT8 inclusive, then it's a cast
+  //
+  Status = SafeIntnToChar8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (-53);
+  Status = SafeIntnToChar8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Operand = (0x5bababab);
+  Status = SafeIntnToChar8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Operand = (-1537977259);
+  Status = SafeIntnToChar8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Status = SafeIntnToChar8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeIntnToUint8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INTN Operand = 0xab;
+  UINT8 Result = 0;
+
+  //
+  // If Operand is between 0 and MAX_UINT8 inclusive, then it's a cast
+  //
+  Status = SafeIntnToUint8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0x5bababab);
+  Status = SafeIntnToUint8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+
+  Operand = (-1537977259);
+  Status = SafeIntnToUint8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+
+  Status = SafeIntnToUint8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeIntnToInt16 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INTN Operand = 0x5bab;
+  INT16 Result = 0;
+
+  //
+  // If Operand is between MIN_INT16 and MAX_INT16 inclusive, then it's a cast
+  //
+  Status = SafeIntnToInt16(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5bab, Result);
+
+  Operand = (-23467);
+  Status = SafeIntnToInt16(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL((-23467), Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0x5bababab);
+  Status = SafeIntnToInt16(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+
+  Operand = (-1537977259);
+  Status = SafeIntnToInt16(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+
+  Status = SafeIntnToInt16(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeIntnToUint16 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INTN Operand = 0xabab;
+  UINT16 Result = 0;
+
+  //
+  // If Operand is between 0 and MAX_UINT16 inclusive, then it's a cast
+  //
+  Status = SafeIntnToUint16(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xabab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0x5bababab);
+  Status = SafeIntnToUint16(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+
+  Operand = (-1537977259);
+  Status = SafeIntnToUint16(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+
+  Status = SafeIntnToUint16(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeIntnToUintn (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INTN Operand = 0x5bababab;
+  UINTN Result = 0;
+
+  //
+  // If Operand is non-negative, then it's a cast
+  //
+  Status = SafeIntnToUintn(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5bababab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (-1537977259);
+  Status = SafeIntnToUintn(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+
+  Status = SafeIntnToUintn(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeIntnToUint64 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INTN Operand = 0x5bababab;
+  UINT64 Result = 0;
+
+  //
+  // If Operand is non-negative, then it's a cast
+  //
+  Status = SafeIntnToUint64(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5bababab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (-1537977259);
+  Status = SafeIntnToUint64(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT64_ERROR, Result);
+
+  Status = SafeIntnToUint64(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnToInt8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINTN Operand = 0x5b;
+  INT8 Result = 0;
+
+  //
+  // If Operand is <= MAX_INT8, then it's a cast
+  //
+  Status = SafeUintnToInt8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xabab);
+  Status = SafeUintnToInt8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+
+  Status = SafeUintnToInt8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnToChar8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINTN Operand = 0x5b;
+  CHAR8 Result = 0;
+
+  // CHAR8 is typedefed as char, which by default is signed, but is
+  // also allowed to be unsigned.
+
+  //
+  // If Operand is <= MAX_INT8, then it's a cast
+  //
+  Status = SafeUintnToChar8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xabab);
+  Status = SafeUintnToChar8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Status = SafeUintnToChar8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnToUint8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINTN Operand = 0xab;
+  UINT8 Result = 0;
+
+  //
+  // If Operand is <= MAX_UINT8, then it's a cast
+  //
+  Status = SafeUintnToUint8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xabab);
+  Status = SafeUintnToUint8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+
+  Status = SafeUintnToUint8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnToInt16 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINTN Operand = 0x5bab;
+  INT16 Result = 0;
+
+  //
+  // If Operand is <= MAX_INT16, then it's a cast
+  //
+  Status = SafeUintnToInt16(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5bab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xabab);
+  Status = SafeUintnToInt16(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+
+  Status = SafeUintnToInt16(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnToUint16 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINTN Operand = 0xabab;
+  UINT16 Result = 0;
+
+  //
+  // If Operand is <= MAX_UINT16, then it's a cast
+  //
+  Status = SafeUintnToUint16(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xabab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xabababab);
+  Status = SafeUintnToUint16(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+
+  Status = SafeUintnToUint16(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnToInt32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINTN Operand = 0x5bababab;
+  INT32 Result = 0;
+
+  //
+  // If Operand is <= MAX_INT32, then it's a cast
+  //
+  Status = SafeUintnToInt32(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5bababab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xabababab);
+  Status = SafeUintnToInt32(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+
+  Status = SafeUintnToInt32(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt64ToInt8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT64 Operand = 0x5b;
+  INT8 Result = 0;
+
+  //
+  // If Operand is between MIN_INT8 and  MAX_INT8 inclusive, then it's a cast
+  //
+  Status = SafeInt64ToInt8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  Operand = (-37);
+  Status = SafeInt64ToInt8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL((-37), Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0x5babababefefefef);
+  Status = SafeInt64ToInt8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+
+  Operand =  (-6605562033422200815);
+  Status = SafeInt64ToInt8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+
+  Status = SafeInt64ToInt8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt64ToChar8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT64 Operand = 0x5b;
+  CHAR8 Result = 0;
+
+  // CHAR8 is typedefed as char, which by default is signed, but is
+  // also allowed to be unsigned.
+
+  //
+  // If Operand is between 0 and  MAX_INT8 inclusive, then it's a cast
+  //
+  Status = SafeInt64ToChar8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (-37);
+  Status = SafeInt64ToChar8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Operand = (0x5babababefefefef);
+  Status = SafeInt64ToChar8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Operand =  (-6605562033422200815);
+  Status = SafeInt64ToChar8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Status = SafeInt64ToChar8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt64ToUint8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT64 Operand = 0xab;
+  UINT8 Result = 0;
+
+  //
+  // If Operand is between 0 and  MAX_UINT8 inclusive, then it's a cast
+  //
+  Status = SafeInt64ToUint8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0x5babababefefefef);
+  Status = SafeInt64ToUint8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+
+  Operand =  (-6605562033422200815);
+  Status = SafeInt64ToUint8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+
+  Status = SafeInt64ToUint8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt64ToInt16 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT64 Operand = 0x5bab;
+  INT16 Result = 0;
+
+  //
+  // If Operand is between MIN_INT16 and  MAX_INT16 inclusive, then it's a cast
+  //
+  Status = SafeInt64ToInt16(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5bab, Result);
+
+  Operand = (-23467);
+  Status = SafeInt64ToInt16(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL((-23467), Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0x5babababefefefef);
+  Status = SafeInt64ToInt16(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+
+  Operand =  (-6605562033422200815);
+  Status = SafeInt64ToInt16(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+
+  Status = SafeInt64ToInt16(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt64ToUint16 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT64 Operand = 0xabab;
+  UINT16 Result = 0;
+
+  //
+  // If Operand is between 0 and  MAX_UINT16 inclusive, then it's a cast
+  //
+  Status = SafeInt64ToUint16(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xabab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0x5babababefefefef);
+  Status = SafeInt64ToUint16(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+
+  Operand =  (-6605562033422200815);
+  Status = SafeInt64ToUint16(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+
+  Status = SafeInt64ToUint16(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt64ToInt32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT64 Operand = 0x5bababab;
+  INT32 Result = 0;
+
+  //
+  // If Operand is between MIN_INT32 and  MAX_INT32 inclusive, then it's a cast
+  //
+  Status = SafeInt64ToInt32(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5bababab, Result);
+
+  Operand = (-1537977259);
+  Status = SafeInt64ToInt32(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL((-1537977259), Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0x5babababefefefef);
+  Status = SafeInt64ToInt32(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+
+  Operand =  (-6605562033422200815);
+  Status = SafeInt64ToInt32(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+
+  Status = SafeInt64ToInt32(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt64ToUint32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT64 Operand = 0xabababab;
+  UINT32 Result = 0;
+
+  //
+  // If Operand is between 0 and  MAX_UINT32 inclusive, then it's a cast
+  //
+  Status = SafeInt64ToUint32(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xabababab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0x5babababefefefef);
+  Status = SafeInt64ToUint32(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+
+  Operand =  (-6605562033422200815);
+  Status = SafeInt64ToUint32(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+
+  Status = SafeInt64ToUint32(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt64ToUint64 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT64 Operand = 0x5babababefefefef;
+  UINT64 Result = 0;
+
+  //
+  // If Operand is non-negative, then it's a cast
+  //
+  Status = SafeInt64ToUint64(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5babababefefefef, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand =  (-6605562033422200815);
+  Status = SafeInt64ToUint64(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT64_ERROR, Result);
+
+  Status = SafeInt64ToUint64(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint64ToInt8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT64 Operand = 0x5b;
+  INT8 Result = 0;
+
+  //
+  // If Operand is <= MAX_INT8, then it's a cast
+  //
+  Status = SafeUint64ToInt8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xababababefefefef);
+  Status = SafeUint64ToInt8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+
+  Status = SafeUint64ToInt8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint64ToChar8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT64 Operand = 0x5b;
+  CHAR8 Result = 0;
+
+  // CHAR8 is typedefed as char, which by default is signed, but is
+  // also allowed to be unsigned.
+
+  //
+  // If Operand is <= MAX_INT8, then it's a cast
+  //
+  Status = SafeUint64ToChar8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5b, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xababababefefefef);
+  Status = SafeUint64ToChar8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Status = SafeUint64ToChar8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint64ToUint8 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT64 Operand = 0xab;
+  UINT8 Result = 0;
+
+  //
+  // If Operand is <= MAX_UINT8, then it's a cast
+  //
+  Status = SafeUint64ToUint8(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xababababefefefef);
+  Status = SafeUint64ToUint8(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+
+  Status = SafeUint64ToUint8(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint64ToInt16 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT64 Operand = 0x5bab;
+  INT16 Result = 0;
+
+  //
+  // If Operand is <= MAX_INT16, then it's a cast
+  //
+  Status = SafeUint64ToInt16(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5bab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xababababefefefef);
+  Status = SafeUint64ToInt16(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+
+  Status = SafeUint64ToInt16(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint64ToUint16 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT64 Operand = 0xabab;
+  UINT16 Result = 0;
+
+  //
+  // If Operand is <= MAX_UINT16, then it's a cast
+  //
+  Status = SafeUint64ToUint16(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xabab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xababababefefefef);
+  Status = SafeUint64ToUint16(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+
+  Status = SafeUint64ToUint16(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint64ToInt32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT64 Operand = 0x5bababab;
+  INT32 Result = 0;
+
+  //
+  // If Operand is <= MAX_INT32, then it's a cast
+  //
+  Status = SafeUint64ToInt32(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5bababab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xababababefefefef);
+  Status = SafeUint64ToInt32(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+
+  Status = SafeUint64ToInt32(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint64ToUint32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT64 Operand = 0xabababab;
+  UINT32 Result = 0;
+
+  //
+  // If Operand is <= MAX_UINT32, then it's a cast
+  //
+  Status = SafeUint64ToUint32(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xabababab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xababababefefefef);
+  Status = SafeUint64ToUint32(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+
+  Status = SafeUint64ToUint32(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint64ToInt64 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT64 Operand = 0x5babababefefefef;
+  INT64 Result = 0;
+
+  //
+  // If Operand is <= MAX_INT64, then it's a cast
+  //
+  Status = SafeUint64ToInt64(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5babababefefefef, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xababababefefefef);
+  Status = SafeUint64ToInt64(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT64_ERROR, Result);
+
+  Status = SafeUint64ToInt64(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+//
+// Addition function tests:
+//
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint8Add (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT8 Augend = 0x3a;
+  UINT8 Addend = 0x3a;
+  UINT8 Result = 0;
+
+  //
+  // If the result of addition doesn't overflow MAX_UINT8, then it's addition
+  //
+  Status = SafeUint8Add(Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x74, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Augend = 0xab;
+  Addend = 0xbc;
+  Status = SafeUint8Add(Augend, Addend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+
+  Status = SafeUint8Add(Augend, Addend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint16Add (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT16 Augend = 0x3a3a;
+  UINT16 Addend = 0x3a3a;
+  UINT16 Result = 0;
+
+  //
+  // If the result of addition doesn't overflow MAX_UINT16, then it's addition
+  //
+  Status = SafeUint16Add(Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x7474, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Augend = 0xabab;
+  Addend = 0xbcbc;
+  Status = SafeUint16Add(Augend, Addend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+
+  Status = SafeUint16Add(Augend, Addend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint32Add (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT32 Augend = 0x3a3a3a3a;
+  UINT32 Addend = 0x3a3a3a3a;
+  UINT32 Result = 0;
+
+  //
+  // If the result of addition doesn't overflow MAX_UINT32, then it's addition
+  //
+  Status = SafeUint32Add(Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x74747474, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Augend = 0xabababab;
+  Addend = 0xbcbcbcbc;
+  Status = SafeUint32Add(Augend, Addend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+
+  Status = SafeUint32Add(Augend, Addend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint64Add (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT64 Augend = 0x3a3a3a3a12121212;
+  UINT64 Addend = 0x3a3a3a3a12121212;
+  UINT64 Result = 0;
+
+  //
+  // If the result of addition doesn't overflow MAX_UINT64, then it's addition
+  //
+  Status = SafeUint64Add(Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x7474747424242424, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Augend = 0xababababefefefef;
+  Addend = 0xbcbcbcbcdededede;
+  Status = SafeUint64Add(Augend, Addend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT64_ERROR, Result);
+
+  Status = SafeUint64Add(Augend, Addend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt8Add (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT8 Augend = 0x3a;
+  INT8 Addend = 0x3a;
+  INT8 Result = 0;
+
+  //
+  // If the result of addition doesn't overflow MAX_INT8
+  // and doesn't underflow MIN_INT8, then it's addition
+  //
+  Status = SafeInt8Add(Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x74, Result);
+
+  Augend = (-58);
+  Addend = (-58);
+  Status = SafeInt8Add(Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL((-116), Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Augend = 0x5a;
+  Addend = 0x5a;
+  Status = SafeInt8Add(Augend, Addend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+
+  Augend = (-90);
+  Addend = (-90);
+  Status = SafeInt8Add(Augend, Addend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+
+  Status = SafeInt8Add(Augend, Addend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeChar8Add (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  CHAR8 Augend = 0x3a;
+  CHAR8 Addend = 0x3a;
+  CHAR8 Result = 0;
+
+  //
+  // If the result of addition doesn't overflow MAX_INT8
+  // and doesn't underflow MIN_INT8, then it's addition
+  //
+  Status = SafeChar8Add(Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x74, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Augend = 0x5a;
+  Addend = 0x5a;
+  Status = SafeChar8Add(Augend, Addend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Augend = 0x85;
+  Addend = 58;
+  Status = SafeChar8Add(Augend, Addend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Augend = 58;
+  Addend = 0x85;
+  Status = SafeChar8Add(Augend, Addend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Status = SafeChar8Add(Augend, Addend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt16Add (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT16 Augend = 0x3a3a;
+  INT16 Addend = 0x3a3a;
+  INT16 Result = 0;
+
+  //
+  // If the result of addition doesn't overflow MAX_INT16
+  // and doesn't underflow MIN_INT16, then it's addition
+  //
+  Status = SafeInt16Add(Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x7474, Result);
+
+  Augend = (-14906);
+  Addend = (-14906);
+  Status = SafeInt16Add(Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL((-29812), Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Augend = 0x5a5a;
+  Addend = 0x5a5a;
+  Status = SafeInt16Add(Augend, Addend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+
+  Augend = (-23130);
+  Addend = (-23130);
+  Status = SafeInt16Add(Augend, Addend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+
+  Status = SafeInt16Add(Augend, Addend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt32Add (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT32 Augend = 0x3a3a3a3a;
+  INT32 Addend = 0x3a3a3a3a;
+  INT32 Result = 0;
+
+  //
+  // If the result of addition doesn't overflow MAX_INT32
+  // and doesn't underflow MIN_INT32, then it's addition
+  //
+  Status = SafeInt32Add(Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x74747474, Result);
+
+  Augend = (-976894522);
+  Addend = (-976894522);
+  Status = SafeInt32Add(Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL((-1953789044), Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Augend = 0x5a5a5a5a;
+  Addend = 0x5a5a5a5a;
+  Status = SafeInt32Add(Augend, Addend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+
+  Augend = (-1515870810);
+  Addend = (-1515870810);
+  Status = SafeInt32Add(Augend, Addend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+
+  Status = SafeInt32Add(Augend, Addend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt64Add (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT64 Augend = 0x3a3a3a3a3a3a3a3a;
+  INT64 Addend = 0x3a3a3a3a3a3a3a3a;
+  INT64 Result = 0;
+
+  //
+  // If the result of addition doesn't overflow MAX_INT64
+  // and doesn't underflow MIN_INT64, then it's addition
+  //
+  Status = SafeInt64Add(Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x7474747474747474, Result);
+
+  Augend = (-4195730024608447034);
+  Addend = (-4195730024608447034);
+  Status = SafeInt64Add(Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL((-8391460049216894068), Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Augend = 0x5a5a5a5a5a5a5a5a;
+  Addend = 0x5a5a5a5a5a5a5a5a;
+  Status = SafeInt64Add(Augend, Addend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT64_ERROR, Result);
+
+  Augend = (-6510615555426900570);
+  Addend = (-6510615555426900570);
+  Status = SafeInt64Add(Augend, Addend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT64_ERROR, Result);
+
+  Status = SafeInt64Add(Augend, Addend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+//
+// Subtraction function tests:
+//
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint8Sub (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT8 Minuend = 0x5a;
+  UINT8 Subtrahend = 0x3b;
+  UINT8 Result = 0;
+
+  //
+  // If Minuend >= Subtrahend, then it's subtraction
+  //
+  Status = SafeUint8Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x1f, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Minuend = 0x5a;
+  Subtrahend = 0x6d;
+  Status = SafeUint8Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+
+  Status = SafeUint8Sub(Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint16Sub (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT16 Minuend = 0x5a5a;
+  UINT16 Subtrahend = 0x3b3b;
+  UINT16 Result = 0;
+
+  //
+  // If Minuend >= Subtrahend, then it's subtraction
+  //
+  Status = SafeUint16Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x1f1f, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Minuend = 0x5a5a;
+  Subtrahend = 0x6d6d;
+  Status = SafeUint16Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+
+  Status = SafeUint16Sub(Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint32Sub (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT32 Minuend = 0x5a5a5a5a;
+  UINT32 Subtrahend = 0x3b3b3b3b;
+  UINT32 Result = 0;
+
+  //
+  // If Minuend >= Subtrahend, then it's subtraction
+  //
+  Status = SafeUint32Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x1f1f1f1f, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Minuend = 0x5a5a5a5a;
+  Subtrahend = 0x6d6d6d6d;
+  Status = SafeUint32Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+
+  Status = SafeUint32Sub(Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint64Sub (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT64 Minuend = 0x5a5a5a5a5a5a5a5a;
+  UINT64 Subtrahend = 0x3b3b3b3b3b3b3b3b;
+  UINT64 Result = 0;
+
+  //
+  // If Minuend >= Subtrahend, then it's subtraction
+  //
+  Status = SafeUint64Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x1f1f1f1f1f1f1f1f, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Minuend = 0x5a5a5a5a5a5a5a5a;
+  Subtrahend = 0x6d6d6d6d6d6d6d6d;
+  Status = SafeUint64Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT64_ERROR, Result);
+
+  Status = SafeUint64Sub(Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt8Sub (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT8 Minuend = 0x5a;
+  INT8 Subtrahend = 0x3a;
+  INT8 Result = 0;
+
+  //
+  // If the result of subtractions doesn't overflow MAX_INT8 or
+  // underflow MIN_INT8, then it's subtraction
+  //
+  Status = SafeInt8Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x20, Result);
+
+  Minuend = 58;
+  Subtrahend = 78;
+  Status = SafeInt8Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL((-20), Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Minuend = (-80);
+  Subtrahend = 80;
+  Status = SafeInt8Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+
+  Minuend = (80);
+  Subtrahend = (-80);
+  Status = SafeInt8Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+
+  Status = SafeInt8Sub(Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeChar8Sub (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  CHAR8 Minuend = 0x5a;
+  CHAR8 Subtrahend = 0x3a;
+  CHAR8 Result = 0;
+
+  //
+  // If the result of subtractions doesn't overflow MAX_INT8 or
+  // underflow MIN_INT8, then it's subtraction
+  //
+  Status = SafeChar8Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x20, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Minuend = 58;
+  Subtrahend = 78;
+  Status = SafeChar8Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Minuend = 0x85;
+  Subtrahend = 80;
+  Status = SafeChar8Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Minuend = (80);
+  Subtrahend = 0x85;
+  Status = SafeChar8Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Status = SafeChar8Sub(Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt16Sub (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT16 Minuend = 0x5a5a;
+  INT16 Subtrahend = 0x3a3a;
+  INT16 Result = 0;
+
+  //
+  // If the result of subtractions doesn't overflow MAX_INT16 or
+  // underflow MIN_INT16, then it's subtraction
+  //
+  Status = SafeInt16Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x2020, Result);
+
+  Minuend = 0x3a3a;
+  Subtrahend = 0x5a5a;
+  Status = SafeInt16Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL((-8224), Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Minuend = (-31354);
+  Subtrahend = 31354;
+  Status = SafeInt16Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+
+  Minuend = (31354);
+  Subtrahend = (-31354);
+  Status = SafeInt16Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+
+  Status = SafeInt16Sub(Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt32Sub (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT32 Minuend = 0x5a5a5a5a;
+  INT32 Subtrahend = 0x3a3a3a3a;
+  INT32 Result = 0;
+
+  //
+  // If the result of subtractions doesn't overflow MAX_INT32 or
+  // underflow MIN_INT32, then it's subtraction
+  //
+  Status = SafeInt32Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x20202020, Result);
+
+  Minuend = 0x3a3a3a3a;
+  Subtrahend = 0x5a5a5a5a;
+  Status = SafeInt32Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL((-538976288), Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Minuend = (-2054847098);
+  Subtrahend = 2054847098;
+  Status = SafeInt32Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+
+  Minuend = (2054847098);
+  Subtrahend = (-2054847098);
+  Status = SafeInt32Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+
+  Status = SafeInt32Sub(Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt64Sub (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT64 Minuend = 0x5a5a5a5a5a5a5a5a;
+  INT64 Subtrahend = 0x3a3a3a3a3a3a3a3a;
+  INT64 Result = 0;
+
+  //
+  // If the result of subtractions doesn't overflow MAX_INT64 or
+  // underflow MIN_INT64, then it's subtraction
+  //
+  Status = SafeInt64Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x2020202020202020, Result);
+
+  Minuend = 0x3a3a3a3a3a3a3a3a;
+  Subtrahend = 0x5a5a5a5a5a5a5a5a;
+  Status = SafeInt64Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL((-2314885530818453536), Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Minuend = (-8825501086245354106);
+  Subtrahend = 8825501086245354106;
+  Status = SafeInt64Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT64_ERROR, Result);
+
+  Minuend = (8825501086245354106);
+  Subtrahend = (-8825501086245354106);
+  Status = SafeInt64Sub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT64_ERROR, Result);
+
+  Status = SafeInt64Sub(Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+//
+// Multiplication function tests:
+//
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint8Mult (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT8 Multiplicand = 0x12;
+  UINT8 Multiplier = 0xa;
+  UINT8 Result = 0;
+
+  //
+  // If the result of multiplication doesn't overflow MAX_UINT8, it will succeed
+  //
+  Status = SafeUint8Mult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xb4, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Multiplicand = 0x12;
+  Multiplier = 0x23;
+  Status = SafeUint8Mult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+
+  Status = SafeUint8Mult(Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint16Mult (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT16 Multiplicand = 0x212;
+  UINT16 Multiplier = 0x7a;
+  UINT16 Result = 0;
+
+  //
+  // If the result of multiplication doesn't overflow MAX_UINT16, it will succeed
+  //
+  Status = SafeUint16Mult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xfc94, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Multiplicand = 0x1234;
+  Multiplier = 0x213;
+  Status = SafeUint16Mult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+
+  Status = SafeUint16Mult(Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint32Mult (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT32 Multiplicand = 0xa122a;
+  UINT32 Multiplier = 0xd23;
+  UINT32 Result = 0;
+
+  //
+  // If the result of multiplication doesn't overflow MAX_UINT32, it will succeed
+  //
+  Status = SafeUint32Mult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x844c9dbe, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Multiplicand = 0xa122a;
+  Multiplier = 0xed23;
+  Status = SafeUint32Mult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+
+  Status = SafeUint32Mult(Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint64Mult (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT64 Multiplicand = 0x123456789a;
+  UINT64 Multiplier = 0x1234567;
+  UINT64 Result = 0;
+
+  //
+  // If the result of multiplication doesn't overflow MAX_UINT64, it will succeed
+  //
+  Status = SafeUint64Mult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x14b66db9745a07f6, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Multiplicand = 0x123456789a;
+  Multiplier = 0x12345678;
+  Status = SafeUint64Mult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT64_ERROR, Result);
+
+  Status = SafeUint64Mult(Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt8Mult (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT8 Multiplicand = 0x12;
+  INT8 Multiplier = 0x7;
+  INT8 Result = 0;
+
+  //
+  // If the result of multiplication doesn't overflow MAX_INT8 and doesn't
+  // underflow MIN_UINT8, it will succeed
+  //
+  Status = SafeInt8Mult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x7e, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Multiplicand = 0x12;
+  Multiplier = 0xa;
+  Status = SafeInt8Mult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+
+  Status = SafeInt8Mult(Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeChar8Mult (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  CHAR8 Multiplicand = 0x12;
+  CHAR8 Multiplier = 0x7;
+  CHAR8 Result = 0;
+
+  //
+  // If the result of multiplication doesn't overflow MAX_INT8 and doesn't
+  // underflow MIN_UINT8, it will succeed
+  //
+  Status = SafeChar8Mult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x7e, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Multiplicand = 0x12;
+  Multiplier = 0xa;
+  Status = SafeChar8Mult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Multiplicand = 0x85;
+  Multiplier = 5;
+  Status = SafeChar8Mult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Multiplicand = 5;
+  Multiplier = 0x85;
+  Status = SafeChar8Mult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+
+  Status = SafeChar8Mult(Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt16Mult (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT16 Multiplicand = 0x123;
+  INT16 Multiplier = 0x67;
+  INT16 Result = 0;
+
+  //
+  // If the result of multiplication doesn't overflow MAX_INT16 and doesn't
+  // underflow MIN_UINT16, it will succeed
+  //
+  Status = SafeInt16Mult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x7515, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Multiplicand = 0x123;
+  Multiplier = 0xab;
+  Status = SafeInt16Mult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+
+  Status = SafeInt16Mult(Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt32Mult (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT32 Multiplicand = 0x123456;
+  INT32 Multiplier = 0x678;
+  INT32 Result = 0;
+
+  //
+  // If the result of multiplication doesn't overflow MAX_INT32 and doesn't
+  // underflow MIN_UINT32, it will succeed
+  //
+  Status = SafeInt32Mult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x75c28c50, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Multiplicand = 0x123456;
+  Multiplier = 0xabc;
+  Status = SafeInt32Mult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+
+  Status = SafeInt32Mult(Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt64Mult (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT64 Multiplicand = 0x123456789;
+  INT64 Multiplier = 0x6789abcd;
+  INT64 Result = 0;
+
+  //
+  // If the result of multiplication doesn't overflow MAX_INT64 and doesn't
+  // underflow MIN_UINT64, it will succeed
+  //
+  Status = SafeInt64Mult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x75cd9045220d6bb5, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Multiplicand = 0x123456789;
+  Multiplier = 0xa789abcd;
+  Status = SafeInt64Mult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT64_ERROR, Result);
+
+  Status = SafeInt64Mult(Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+
+
+/**
+
+  Main fuction sets up the unit test environment
+
+**/
+EFI_STATUS
+EFIAPI
+UefiMain (
+  IN EFI_HANDLE         ImageHandle,
+  IN EFI_SYSTEM_TABLE*  SystemTable
+  )
+{
+  EFI_STATUS  Status;
+  UNIT_TEST_FRAMEWORK       *Fw = NULL;
+  UNIT_TEST_SUITE           *ConversionTestSuite;
+  UNIT_TEST_SUITE           *AdditionSubtractionTestSuite;
+  UNIT_TEST_SUITE           *MultiplicationTestSuite;
+  CHAR16  ShortName[100];
+  ShortName[0] = L'\0';
+
+  UnicodeSPrint(&ShortName[0], sizeof(ShortName), L"%a", gEfiCallerBaseName);
+  DEBUG((DEBUG_INFO, "%s v%s\n", UNIT_TEST_APP_NAME, UNIT_TEST_APP_VERSION));
+
+  //
+  // Start setting up the test framework for running the tests.
+  //
+  Status = InitUnitTestFramework(&Fw, UNIT_TEST_APP_NAME, ShortName, UNIT_TEST_APP_VERSION);
+  if (EFI_ERROR(Status))
+  {
+    DEBUG((DEBUG_ERROR, "Failed in InitUnitTestFramework. Status = %r\n", Status));
+    goto EXIT;
+  }
+
+  ///
+  // Test the conversion functions
+  //
+  Status = CreateUnitTestSuite(&ConversionTestSuite, Fw, L"Int Safe Conversions Test Suite", L"Common.IntSafe.Convert", NULL, NULL);
+  if (EFI_ERROR(Status))
+  {
+    DEBUG((DEBUG_ERROR, "Failed in CreateUnitTestSuite for Conversions Test Suite\n"));
+    Status = EFI_OUT_OF_RESOURCES;
+    goto EXIT;
+  }
+  AddTestCase(ConversionTestSuite, L"Test SafeInt8ToUint8",    L"Common.IntSafe.Convert.TestSafeInt8ToUint8",    TestSafeInt8ToUint8,    NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt8ToChar8",    L"Common.IntSafe.Convert.TestSafeInt8ToChar8",    TestSafeInt8ToChar8,    NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt8ToUint16",   L"Common.IntSafe.Convert.TestSafeInt8ToUint16",   TestSafeInt8ToUint16,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt8ToUint32",   L"Common.IntSafe.Convert.TestSafeInt8ToUint32",   TestSafeInt8ToUint32,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt8ToUintn",    L"Common.IntSafe.Convert.TestSafeInt8ToUintn",    TestSafeInt8ToUintn,    NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt8ToUint64",   L"Common.IntSafe.Convert.TestSafeInt8ToUint64",   TestSafeInt8ToUint64,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUint8ToInt8",    L"Common.IntSafe.Convert.TestSafeUint8ToInt8",    TestSafeUint8ToInt8,    NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUint8ToChar8",   L"Common.IntSafe.Convert.TestSafeUint8ToChar8",   TestSafeUint8ToChar8,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt16ToInt8",    L"Common.IntSafe.Convert.TestSafeInt16ToInt8",    TestSafeInt16ToInt8,    NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt16ToChar8",   L"Common.IntSafe.Convert.TestSafeInt16ToChar8",   TestSafeInt16ToChar8,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt16ToUint8",   L"Common.IntSafe.Convert.TestSafeInt16ToUint8",   TestSafeInt16ToUint8,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt16ToUint16",  L"Common.IntSafe.Convert.TestSafeInt16ToUint16",  TestSafeInt16ToUint16,  NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt16ToUint32",  L"Common.IntSafe.Convert.TestSafeInt16ToUint32",  TestSafeInt16ToUint32,  NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt16ToUintn",   L"Common.IntSafe.Convert.TestSafeInt16ToUintn",   TestSafeInt16ToUintn,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt16ToUint64",  L"Common.IntSafe.Convert.TestSafeInt16ToUint64",  TestSafeInt16ToUint64,  NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUint16ToInt8",   L"Common.IntSafe.Convert.TestSafeUint16ToInt8",   TestSafeUint16ToInt8,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUint16ToChar8",  L"Common.IntSafe.Convert.TestSafeUint16ToChar8",  TestSafeUint16ToChar8,  NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUint16ToUint8",  L"Common.IntSafe.Convert.TestSafeUint16ToUint8",  TestSafeUint16ToUint8,  NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUint16ToInt16",  L"Common.IntSafe.Convert.TestSafeUint16ToInt16",  TestSafeUint16ToInt16,  NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt32ToInt8",    L"Common.IntSafe.Convert.TestSafeInt32ToInt8",    TestSafeInt32ToInt8,    NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt32ToChar8",   L"Common.IntSafe.Convert.TestSafeInt32ToChar8",   TestSafeInt32ToChar8,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt32ToUint8",   L"Common.IntSafe.Convert.TestSafeInt32ToUint8",   TestSafeInt32ToUint8,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt32ToInt16",   L"Common.IntSafe.Convert.TestSafeInt32ToInt16",   TestSafeInt32ToInt16,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt32ToUint16",  L"Common.IntSafe.Convert.TestSafeInt32ToUint16",  TestSafeInt32ToUint16,  NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt32ToUint32",  L"Common.IntSafe.Convert.TestSafeInt32ToUint32",  TestSafeInt32ToUint32,  NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt32ToUintn",   L"Common.IntSafe.Convert.TestSafeInt32ToUintn",   TestSafeInt32ToUintn,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt32ToUint64",  L"Common.IntSafe.Convert.TestSafeInt32ToUint64",  TestSafeInt32ToUint64,  NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUint32ToInt8",   L"Common.IntSafe.Convert.TestSafeUint32ToInt8",   TestSafeUint32ToInt8,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUint32ToChar8",  L"Common.IntSafe.Convert.TestSafeUint32ToChar8",  TestSafeUint32ToChar8,  NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUint32ToUint8",  L"Common.IntSafe.Convert.TestSafeUint32ToUint8",  TestSafeUint32ToUint8,  NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUint32ToInt16",  L"Common.IntSafe.Convert.TestSafeUint32ToInt16",  TestSafeUint32ToInt16,  NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUint32ToUint16", L"Common.IntSafe.Convert.TestSafeUint32ToUint16", TestSafeUint32ToUint16, NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUint32ToInt32",  L"Common.IntSafe.Convert.TestSafeUint32ToInt32",  TestSafeUint32ToInt32,  NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUint32ToIntn",   L"Common.IntSafe.Convert.TestSafeUint32ToIntn",   TestSafeUint32ToIntn,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeIntnToInt8",     L"Common.IntSafe.Convert.TestSafeIntnToInt8",     TestSafeIntnToInt8,     NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeIntnToChar8",    L"Common.IntSafe.Convert.TestSafeIntnToChar8",    TestSafeIntnToChar8,    NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeIntnToUint8",    L"Common.IntSafe.Convert.TestSafeIntnToUint8",    TestSafeIntnToUint8,    NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeIntnToInt16",    L"Common.IntSafe.Convert.TestSafeIntnToInt16",    TestSafeIntnToInt16,    NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeIntnToUint16",   L"Common.IntSafe.Convert.TestSafeIntnToUint16",   TestSafeIntnToUint16,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeIntnToInt32",    L"Common.IntSafe.Convert.TestSafeIntnToInt32",    TestSafeIntnToInt32,    NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeIntnToUint32",   L"Common.IntSafe.Convert.TestSafeIntnToUint32",   TestSafeIntnToUint32,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeIntnToUintn",    L"Common.IntSafe.Convert.TestSafeIntnToUintn",    TestSafeIntnToUintn,    NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeIntnToUint64",   L"Common.IntSafe.Convert.TestSafeIntnToUint64",   TestSafeIntnToUint64,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUintnToInt8",    L"Common.IntSafe.Convert.TestSafeUintnToInt8",    TestSafeUintnToInt8,    NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUintnToChar8",   L"Common.IntSafe.Convert.TestSafeUintnToChar8",   TestSafeUintnToChar8,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUintnToUint8",   L"Common.IntSafe.Convert.TestSafeUintnToUint8",   TestSafeUintnToUint8,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUintnToInt16",   L"Common.IntSafe.Convert.TestSafeUintnToInt16",   TestSafeUintnToInt16,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUintnToUint16",  L"Common.IntSafe.Convert.TestSafeUintnToUint16",  TestSafeUintnToUint16,  NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUintnToInt32",   L"Common.IntSafe.Convert.TestSafeUintnToInt32",   TestSafeUintnToInt32,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUintnToUint32",  L"Common.IntSafe.Convert.TestSafeUintnToUint32",  TestSafeUintnToUint32,  NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUintnToIntn",    L"Common.IntSafe.Convert.TestSafeUintnToIntn",    TestSafeUintnToIntn,    NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUintnToInt64",   L"Common.IntSafe.Convert.TestSafeUintnToInt64",   TestSafeUintnToInt64,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt64ToInt8",    L"Common.IntSafe.Convert.TestSafeInt64ToInt8",    TestSafeInt64ToInt8,    NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt64ToChar8",   L"Common.IntSafe.Convert.TestSafeInt64ToChar8",   TestSafeInt64ToChar8,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt64ToUint8",   L"Common.IntSafe.Convert.TestSafeInt64ToUint8",   TestSafeInt64ToUint8,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt64ToInt16",   L"Common.IntSafe.Convert.TestSafeInt64ToInt16",   TestSafeInt64ToInt16,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt64ToUint16",  L"Common.IntSafe.Convert.TestSafeInt64ToUint16",  TestSafeInt64ToUint16,  NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt64ToInt32",   L"Common.IntSafe.Convert.TestSafeInt64ToInt32",   TestSafeInt64ToInt32,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt64ToUint32",  L"Common.IntSafe.Convert.TestSafeInt64ToUint32",  TestSafeInt64ToUint32,  NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt64ToIntn",    L"Common.IntSafe.Convert.TestSafeInt64ToIntn",    TestSafeInt64ToIntn,    NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt64ToUintn",   L"Common.IntSafe.Convert.TestSafeInt64ToUintn",   TestSafeInt64ToUintn,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeInt64ToUint64",  L"Common.IntSafe.Convert.TestSafeInt64ToUint64",  TestSafeInt64ToUint64,  NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUint64ToInt8",   L"Common.IntSafe.Convert.TestSafeUint64ToInt8",   TestSafeUint64ToInt8,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUint64ToChar8",  L"Common.IntSafe.Convert.TestSafeUint64ToChar8",  TestSafeUint64ToChar8,  NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUint64ToUint8",  L"Common.IntSafe.Convert.TestSafeUint64ToUint8",  TestSafeUint64ToUint8,  NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUint64ToInt16",  L"Common.IntSafe.Convert.TestSafeUint64ToInt16",  TestSafeUint64ToInt16,  NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUint64ToUint16", L"Common.IntSafe.Convert.TestSafeUint64ToUint16", TestSafeUint64ToUint16, NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUint64ToInt32",  L"Common.IntSafe.Convert.TestSafeUint64ToInt32",  TestSafeUint64ToInt32,  NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUint64ToUint32", L"Common.IntSafe.Convert.TestSafeUint64ToUint32", TestSafeUint64ToUint32, NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUint64ToIntn",   L"Common.IntSafe.Convert.TestSafeUint64ToIntn",   TestSafeUint64ToIntn,   NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUint64ToUintn",  L"Common.IntSafe.Convert.TestSafeUint64ToUintn",  TestSafeUint64ToUintn,  NULL, NULL, NULL);
+  AddTestCase(ConversionTestSuite, L"Test SafeUint64ToInt64",  L"Common.IntSafe.Convert.TestSafeUint64ToInt64",  TestSafeUint64ToInt64,  NULL, NULL, NULL);
+
+  //
+  // Test the addition and subtraction functions
+  //
+  Status = CreateUnitTestSuite(&AdditionSubtractionTestSuite, Fw, L"Int Safe Add/Subtract Test Suite", L"Common.IntSafe.AddSubtract", NULL, NULL);
+  if (EFI_ERROR(Status))
+  {
+    DEBUG((DEBUG_ERROR, "Failed in CreateUnitTestSuite for Int Safe Add/Subtract Test Suite\n"));
+    Status = EFI_OUT_OF_RESOURCES;
+    goto EXIT;
+  }
+  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeUint8Add",  L"Common.IntSafe.AddSubtract.TestSafeUint8Add",  TestSafeUint8Add,  NULL, NULL, NULL);
+  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeUint16Add", L"Common.IntSafe.AddSubtract.TestSafeUint16Add", TestSafeUint16Add, NULL, NULL, NULL);
+  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeUint32Add", L"Common.IntSafe.AddSubtract.TestSafeUint32Add", TestSafeUint32Add, NULL, NULL, NULL);
+  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeUintnAdd",  L"Common.IntSafe.AddSubtract.TestSafeUintnAdd",  TestSafeUintnAdd,  NULL, NULL, NULL);
+  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeUint64Add", L"Common.IntSafe.AddSubtract.TestSafeUint64Add", TestSafeUint64Add, NULL, NULL, NULL);
+  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeInt8Add",   L"Common.IntSafe.AddSubtract.TestSafeInt8Add",   TestSafeInt8Add,   NULL, NULL, NULL);
+  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeChar8Add",  L"Common.IntSafe.AddSubtract.TestSafeChar8Add",  TestSafeChar8Add,  NULL, NULL, NULL);
+  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeInt16Add",  L"Common.IntSafe.AddSubtract.TestSafeInt16Add",  TestSafeInt16Add,  NULL, NULL, NULL);
+  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeInt32Add",  L"Common.IntSafe.AddSubtract.TestSafeInt32Add",  TestSafeInt32Add,  NULL, NULL, NULL);
+  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeIntnAdd",   L"Common.IntSafe.AddSubtract.TestSafeIntnAdd",   TestSafeIntnAdd,   NULL, NULL, NULL);
+  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeInt64Add",  L"Common.IntSafe.AddSubtract.TestSafeInt64Add",  TestSafeInt64Add,  NULL, NULL, NULL);
+  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeUint8Sub",  L"Common.IntSafe.AddSubtract.TestSafeUint8Sub",  TestSafeUint8Sub,  NULL, NULL, NULL);
+  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeUint16Sub", L"Common.IntSafe.AddSubtract.TestSafeUint16Sub", TestSafeUint16Sub, NULL, NULL, NULL);
+  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeUint32Sub", L"Common.IntSafe.AddSubtract.TestSafeUint32Sub", TestSafeUint32Sub, NULL, NULL, NULL);
+  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeUintnSub",  L"Common.IntSafe.AddSubtract.TestSafeUintnSub",  TestSafeUintnSub,  NULL, NULL, NULL);
+  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeUint64Sub", L"Common.IntSafe.AddSubtract.TestSafeUint64Sub", TestSafeUint64Sub, NULL, NULL, NULL);
+  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeInt8Sub",   L"Common.IntSafe.AddSubtract.TestSafeInt8Sub",   TestSafeInt8Sub,   NULL, NULL, NULL);
+  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeChar8Sub",  L"Common.IntSafe.AddSubtract.TestSafeChar8Sub",  TestSafeChar8Sub,  NULL, NULL, NULL);
+  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeInt16Sub",  L"Common.IntSafe.AddSubtract.TestSafeInt16Sub",  TestSafeInt16Sub,  NULL, NULL, NULL);
+  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeInt32Sub",  L"Common.IntSafe.AddSubtract.TestSafeInt32Sub",  TestSafeInt32Sub,  NULL, NULL, NULL);
+  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeIntnSub",   L"Common.IntSafe.AddSubtract.TestSafeIntnSub",   TestSafeIntnSub,   NULL, NULL, NULL);
+  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeInt64Sub",  L"Common.IntSafe.AddSubtract.TestSafeInt64Sub",  TestSafeInt64Sub,  NULL, NULL, NULL);
+
+  //
+  // Test the multiplication functions
+  //
+  Status = CreateUnitTestSuite(&MultiplicationTestSuite, Fw, L"Int Safe Multiply Test Suite", L"Common.IntSafe.Multiply", NULL, NULL);
+  if (EFI_ERROR(Status))
+  {
+    DEBUG((DEBUG_ERROR, "Failed in CreateUnitTestSuite for Int Safe Multiply Test Suite\n"));
+    Status = EFI_OUT_OF_RESOURCES;
+    goto EXIT;
+  }
+  AddTestCase(MultiplicationTestSuite, L"Test SafeUint8Mult",  L"Common.IntSafe.Multiply.TestSafeUint8Mult",  TestSafeUint8Mult,  NULL, NULL, NULL);
+  AddTestCase(MultiplicationTestSuite, L"Test SafeUint16Mult", L"Common.IntSafe.Multiply.TestSafeUint16Mult", TestSafeUint16Mult, NULL, NULL, NULL);
+  AddTestCase(MultiplicationTestSuite, L"Test SafeUint32Mult", L"Common.IntSafe.Multiply.TestSafeUint32Mult", TestSafeUint32Mult, NULL, NULL, NULL);
+  AddTestCase(MultiplicationTestSuite, L"Test SafeUintnMult",  L"Common.IntSafe.Multiply.TestSafeUintnMult",  TestSafeUintnMult,  NULL, NULL, NULL);
+  AddTestCase(MultiplicationTestSuite, L"Test SafeUint64Mult", L"Common.IntSafe.Multiply.TestSafeUint64Mult", TestSafeUint64Mult, NULL, NULL, NULL);
+  AddTestCase(MultiplicationTestSuite, L"Test SafeInt8Mult",   L"Common.IntSafe.Multiply.TestSafeInt8Mult",   TestSafeInt8Mult,   NULL, NULL, NULL);
+  AddTestCase(MultiplicationTestSuite, L"Test SafeChar8Mult",  L"Common.IntSafe.Multiply.TestSafeChar8Mult",  TestSafeChar8Mult,  NULL, NULL, NULL);
+  AddTestCase(MultiplicationTestSuite, L"Test SafeInt16Mult",  L"Common.IntSafe.Multiply.TestSafeInt16Mult",  TestSafeInt16Mult,  NULL, NULL, NULL);
+  AddTestCase(MultiplicationTestSuite, L"Test SafeInt32Mult",  L"Common.IntSafe.Multiply.TestSafeInt32Mult",  TestSafeInt32Mult,  NULL, NULL, NULL);
+  AddTestCase(MultiplicationTestSuite, L"Test SafeIntnMult",   L"Common.IntSafe.Multiply.TestSafeIntnMult",   TestSafeIntnMult,   NULL, NULL, NULL);
+  AddTestCase(MultiplicationTestSuite, L"Test SafeInt64Mult",  L"Common.IntSafe.Multiply.TestSafeInt64Mult",  TestSafeInt64Mult,  NULL, NULL, NULL);
+
+  //
+  // Execute the tests.
+  //
+  Status = RunAllTestSuites(Fw);
+
+EXIT:
+  if (Fw)
+  {
+    FreeUnitTestFramework(Fw);
+  }
+
+  return Status;
+}
diff --git a/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.h b/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.h
new file mode 100644
index 0000000000..749e9cd7b1
--- /dev/null
+++ b/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.h
@@ -0,0 +1,155 @@
+/** @file
+  UEFI Shell based application for unit testing the SafeIntLib.
+
+  Copyright (c) 2017, Microsoft Corporation
+
+  All rights reserved.
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions are met:
+  1. Redistributions of source code must retain the above copyright notice,
+  this list of conditions and the following disclaimer.
+  2. Redistributions in binary form must reproduce the above copyright notice,
+  this list of conditions and the following disclaimer in the documentation
+  and/or other materials provided with the distribution.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+**/
+
+#include <Uefi.h>
+#include <Library/UefiLib.h>
+#include <Library/PrintLib.h>
+#include <Library/DebugLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <UnitTestTypes.h>
+#include <Library/UnitTestLib.h>
+#include <Library/UnitTestAssertLib.h>
+#include <Library/SafeIntLib.h>
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt32ToUintn(
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  );
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint32ToIntn(
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  );
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeIntnToInt32(
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  );
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeIntnToUint32(
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  );
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnToUint32(
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  );
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnToIntn(
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  );
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnToInt64(
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  );
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt64ToIntn(
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  );
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt64ToUintn(
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  );
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint64ToIntn(
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  );
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint64ToUintn(
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  );
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnAdd(
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  );
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeIntnAdd(
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  );
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnSub(
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  );
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeIntnSub(
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  );
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnMult(
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  );
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeIntnMult(
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  );
diff --git a/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.inf b/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.inf
new file mode 100644
index 0000000000..ce16773ba0
--- /dev/null
+++ b/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.inf
@@ -0,0 +1,69 @@
+## @file
+# Uefi Shell based Application that Unit Tests the SafeIntLib
+#
+# Copyright (c) 2017, Microsoft Corporation
+
+# All rights reserved.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+##
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = SafeIntLibUnitTestApp
+  FILE_GUID                      = 9D783A1B-4593-49BA-8511-363FE72156D1
+  MODULE_TYPE                    = UEFI_APPLICATION
+  VERSION_STRING                 = 1.0
+  ENTRY_POINT                    = UefiMain
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+#  VALID_ARCHITECTURES           = IA32 X64
+#
+
+[Sources]
+  SafeIntLibUnitTests.c
+  SafeIntLibUnitTests.h
+
+[Sources.IA32, Sources.ARM]
+  SafeIntLibUnitTests32.c
+  SafeIntLibUintnIntnUnitTests32.c
+
+[Sources.X64, Sources.IPF, Sources.AARCH64]
+  SafeIntLibUnitTests64.c
+  SafeIntLibUintnIntnUnitTests64.c
+
+[Sources.EBC]
+  SafeIntLibUnitTests32.c
+  SafeIntLibUnitTests64.c
+  SafeIntLibUintnIntnUnitTestsEbc.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MsUnitTestPkg/MsUnitTestPkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+
+[LibraryClasses]
+  UefiApplicationEntryPoint
+  BaseLib
+  SafeIntLib
+  UnitTestLib
+  UnitTestAssertLib
+  PrintLib
diff --git a/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests32.c b/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests32.c
new file mode 100644
index 0000000000..242773b487
--- /dev/null
+++ b/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests32.c
@@ -0,0 +1,595 @@
+/** @file
+  32-bit specific functions for unit-testing INTN and UINTN functions in
+  SafeIntLib.
+
+  Copyright (c) 2017, Microsoft Corporation
+
+  All rights reserved.
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions are met:
+  1. Redistributions of source code must retain the above copyright notice,
+  this list of conditions and the following disclaimer.
+  2. Redistributions in binary form must reproduce the above copyright notice,
+  this list of conditions and the following disclaimer in the documentation
+  and/or other materials provided with the distribution.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+**/
+
+#include "SafeIntLibUnitTests.h"
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt32ToUintn_32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT32 Operand = 0x5bababab;
+  UINTN Result = 0;
+
+  //
+  // If Operand is non-negative, then it's a cast
+  //
+  Status = SafeInt32ToUintn(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5bababab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (-1537977259);
+  Status = SafeInt32ToUintn(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+
+  Status = SafeInt32ToUintn(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint32ToIntn_32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT32 Operand = 0x5bababab;
+  INTN Result = 0;
+
+  //
+  // If Operand is <= MAX_INTN, then it's a cast
+  //
+  Status = SafeUint32ToIntn(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5bababab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xabababab);
+  Status = SafeUint32ToIntn(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+
+  Status = SafeUint32ToIntn(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeIntnToInt32_32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INTN Operand = 0x5bababab;
+  INT32 Result = 0;
+
+  //
+  // INTN is same as INT32 in IA32, so this is just a cast
+  //
+  Status = SafeIntnToInt32(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5bababab, Result);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeIntnToUint32_32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INTN Operand = 0x5bababab;
+  UINT32 Result = 0;
+
+  //
+  // If Operand is non-negative, then it's a cast
+  //
+  Status = SafeIntnToUint32(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5bababab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (-1537977259);
+  Status = SafeIntnToUint32(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+
+  Status = SafeIntnToUint32(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnToUint32_32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINTN Operand = 0xabababab;
+  UINT32 Result = 0;
+
+  //
+  // UINTN is same as UINT32 in IA32, so this is just a cast
+  //
+  Status = SafeUintnToUint32(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xabababab, Result);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnToIntn_32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINTN Operand = 0x5bababab;
+  INTN Result = 0;
+
+  //
+  // If Operand is <= MAX_INTN, then it's a cast
+  //
+  Status = SafeUintnToIntn(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5bababab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xabababab);
+  Status = SafeUintnToIntn(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+
+  Status = SafeUintnToIntn(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnToInt64_32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINTN Operand = 0xabababab;
+  INT64 Result = 0;
+
+  //
+  // UINTN is same as UINT32 in IA32, and UINT32 is a subset of
+  // INT64, so this is just a cast
+  //
+  Status = SafeUintnToInt64(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xabababab, Result);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt64ToIntn_32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT64 Operand = 0x5bababab;
+  INTN Result = 0;
+
+  //
+  // If Operand is between MIN_INTN and  MAX_INTN2 inclusive, then it's a cast
+  //
+  Status = SafeInt64ToIntn(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5bababab, Result);
+
+  Operand = (-1537977259);
+  Status = SafeInt64ToIntn(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL((-1537977259), Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0x5babababefefefef);
+  Status = SafeInt64ToIntn(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+
+  Operand =  (-6605562033422200815);
+  Status = SafeInt64ToIntn(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+
+  Status = SafeInt64ToIntn(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt64ToUintn_32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT64 Operand = 0xabababab;
+  UINTN Result = 0;
+
+  //
+  // If Operand is between 0 and  MAX_UINTN inclusive, then it's a cast
+  //
+  Status = SafeInt64ToUintn(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xabababab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0x5babababefefefef);
+  Status = SafeInt64ToUintn(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+
+  Operand =  (-6605562033422200815);
+  Status = SafeInt64ToUintn(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+
+  Status = SafeInt64ToUintn(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint64ToIntn_32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT64 Operand = 0x5bababab;
+  INTN Result = 0;
+
+  //
+  // If Operand is <= MAX_INTN, then it's a cast
+  //
+  Status = SafeUint64ToIntn(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5bababab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xababababefefefef);
+  Status = SafeUint64ToIntn(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+
+  Status = SafeUint64ToIntn(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint64ToUintn_32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT64 Operand = 0xabababab;
+  UINTN Result = 0;
+
+  //
+  // If Operand is <= MAX_UINTN, then it's a cast
+  //
+  Status = SafeUint64ToUintn(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xabababab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xababababefefefef);
+  Status = SafeUint64ToUintn(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+
+  Status = SafeUint64ToUintn(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnAdd_32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINTN Augend = 0x3a3a3a3a;
+  UINTN Addend = 0x3a3a3a3a;
+  UINTN Result = 0;
+
+  //
+  // If the result of addition doesn't overflow MAX_UINTN, then it's addition
+  //
+  Status = SafeUintnAdd(Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x74747474, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Augend = 0xabababab;
+  Addend = 0xbcbcbcbc;
+  Status = SafeUintnAdd(Augend, Addend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+
+  Status = SafeUintnAdd(Augend, Addend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeIntnAdd_32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INTN Augend = 0x3a3a3a3a;
+  INTN Addend = 0x3a3a3a3a;
+  INTN Result = 0;
+
+  //
+  // If the result of addition doesn't overflow MAX_INTN
+  // and doesn't underflow MIN_INTN, then it's addition
+  //
+  Status = SafeIntnAdd(Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x74747474, Result);
+
+  Augend = (-976894522);
+  Addend = (-976894522);
+  Status = SafeIntnAdd(Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL((-1953789044), Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Augend = 0x5a5a5a5a;
+  Addend = 0x5a5a5a5a;
+  Status = SafeIntnAdd(Augend, Addend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+
+  Augend = (-1515870810);
+  Addend = (-1515870810);
+  Status = SafeIntnAdd(Augend, Addend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+
+  Status = SafeIntnAdd(Augend, Addend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnSub_32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINTN Minuend = 0x5a5a5a5a;
+  UINTN Subtrahend = 0x3b3b3b3b;
+  UINTN Result = 0;
+
+  //
+  // If Minuend >= Subtrahend, then it's subtraction
+  //
+  Status = SafeUintnSub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x1f1f1f1f, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Minuend = 0x5a5a5a5a;
+  Subtrahend = 0x6d6d6d6d;
+  Status = SafeUintnSub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+
+  Status = SafeUintnSub(Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeIntnSub_32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INTN Minuend = 0x5a5a5a5a;
+  INTN Subtrahend = 0x3a3a3a3a;
+  INTN Result = 0;
+
+  //
+  // If the result of subtractions doesn't overflow MAX_INTN or
+  // underflow MIN_INTN, then it's subtraction
+  //
+  Status = SafeIntnSub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x20202020, Result);
+
+  Minuend = 0x3a3a3a3a;
+  Subtrahend = 0x5a5a5a5a;
+  Status = SafeIntnSub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL((-538976288), Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Minuend = (-2054847098);
+  Subtrahend = 2054847098;
+  Status = SafeIntnSub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+
+  Minuend = (2054847098);
+  Subtrahend = (-2054847098);
+  Status = SafeIntnSub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+
+  Status = SafeIntnSub(Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnMult_32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINTN Multiplicand = 0xa122a;
+  UINTN Multiplier = 0xd23;
+  UINTN Result = 0;
+
+  //
+  // If the result of multiplication doesn't overflow MAX_UINTN, it will succeed
+  //
+  Status = SafeUintnMult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x844c9dbe, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Multiplicand = 0xa122a;
+  Multiplier = 0xed23;
+  Status = SafeUintnMult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+
+  Status = SafeUintnMult(Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeIntnMult_32 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INTN Multiplicand = 0x123456;
+  INTN Multiplier = 0x678;
+  INTN Result = 0;
+
+  //
+  // If the result of multiplication doesn't overflow MAX_INTN and doesn't
+  // underflow MIN_UINTN, it will succeed
+  //
+  Status = SafeIntnMult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x75c28c50, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Multiplicand = 0x123456;
+  Multiplier = 0xabc;
+  Status = SafeIntnMult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+
+  Status = SafeIntnMult(Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
diff --git a/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests64.c b/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests64.c
new file mode 100644
index 0000000000..59eb4f72d6
--- /dev/null
+++ b/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests64.c
@@ -0,0 +1,599 @@
+/** @file
+  64-bit specific functions for unit-testing INTN and UINTN functions in
+  SafeIntLib.
+
+  Copyright (c) 2017, Microsoft Corporation
+
+  All rights reserved.
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions are met:
+  1. Redistributions of source code must retain the above copyright notice,
+  this list of conditions and the following disclaimer.
+  2. Redistributions in binary form must reproduce the above copyright notice,
+  this list of conditions and the following disclaimer in the documentation
+  and/or other materials provided with the distribution.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+**/
+
+#include "SafeIntLibUnitTests.h"
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt32ToUintn_64 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT32 Operand = 0x5bababab;
+  UINTN Result = 0;
+
+  //
+  // If Operand is non-negative, then it's a cast
+  //
+  Status = SafeInt32ToUintn(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5bababab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (-1537977259);
+  Status = SafeInt32ToUintn(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+
+  Status = SafeInt32ToUintn(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint32ToIntn_64 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT32 Operand = 0xabababab;
+  INTN Result = 0;
+
+  //
+  // For x64, INTN is same as INT64 which is a superset of INT32
+  // This is just a cast then, and it'll never fail
+  //
+
+  //
+  // If Operand is non-negative, then it's a cast
+  //
+  Status = SafeUint32ToIntn(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xabababab, Result);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeIntnToInt32_64 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INTN Operand = 0x5bababab;
+  INT32 Result = 0;
+
+  //
+  // If Operand is between MIN_INT32 and  MAX_INT32 inclusive, then it's a cast
+  //
+  Status = SafeIntnToInt32(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5bababab, Result);
+
+  Operand = (-1537977259);
+  Status = SafeIntnToInt32(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL((-1537977259), Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0x5babababefefefef);
+  Status = SafeIntnToInt32(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+
+  Operand =  (-6605562033422200815);
+  Status = SafeIntnToInt32(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+
+  Status = SafeIntnToInt32(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeIntnToUint32_64 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INTN Operand = 0xabababab;
+  UINT32 Result = 0;
+
+  //
+  // If Operand is between 0 and  MAX_UINT32 inclusive, then it's a cast
+  //
+  Status = SafeIntnToUint32(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xabababab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0x5babababefefefef);
+  Status = SafeIntnToUint32(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+
+  Operand =  (-6605562033422200815);
+  Status = SafeIntnToUint32(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+
+  Status = SafeIntnToUint32(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnToUint32_64 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINTN Operand = 0xabababab;
+  UINT32 Result = 0;
+
+  //
+  // If Operand is <= MAX_UINT32, then it's a cast
+  //
+  Status = SafeUintnToUint32(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xabababab, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xababababefefefef);
+  Status = SafeUintnToUint32(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+
+  Status = SafeUintnToUint32(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnToIntn_64 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINTN Operand = 0x5babababefefefef;
+  INTN Result = 0;
+
+  //
+  // If Operand is <= MAX_INTN (0x7fff_ffff_ffff_ffff), then it's a cast
+  //
+  Status = SafeUintnToIntn(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5babababefefefef, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xababababefefefef);
+  Status = SafeUintnToIntn(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+
+  Status = SafeUintnToIntn(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnToInt64_64 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINTN Operand = 0x5babababefefefef;
+  INT64 Result = 0;
+
+  //
+  // If Operand is <= MAX_INT64, then it's a cast
+  //
+  Status = SafeUintnToInt64(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5babababefefefef, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xababababefefefef);
+  Status = SafeUintnToInt64(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INT64_ERROR, Result);
+
+  Status = SafeUintnToInt64(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt64ToIntn_64 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT64 Operand = 0x5babababefefefef;
+  INTN Result = 0;
+
+  //
+  // INTN is same as INT64 in x64, so this is just a cast
+  //
+  Status = SafeInt64ToIntn(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5babababefefefef, Result);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeInt64ToUintn_64 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INT64 Operand = 0x5babababefefefef;
+  UINTN Result = 0;
+
+  //
+  // If Operand is non-negative, then it's a cast
+  //
+  Status = SafeInt64ToUintn(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5babababefefefef, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand =  (-6605562033422200815);
+  Status = SafeInt64ToUintn(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+
+  Status = SafeInt64ToUintn(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint64ToIntn_64 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT64 Operand = 0x5babababefefefef;
+  INTN Result = 0;
+
+  //
+  // If Operand is <= MAX_INTN (0x7fff_ffff_ffff_ffff), then it's a cast
+  //
+  Status = SafeUint64ToIntn(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x5babababefefefef, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Operand = (0xababababefefefef);
+  Status = SafeUint64ToIntn(Operand, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+
+  Status = SafeUint64ToIntn(Operand, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUint64ToUintn_64 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINT64 Operand = 0xababababefefefef;
+  UINTN Result = 0;
+
+  //
+  // UINTN is same as UINT64 in x64, so this is just a cast
+  //
+  Status = SafeUint64ToUintn(Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0xababababefefefef, Result);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnAdd_64 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINTN Augend = 0x3a3a3a3a12121212;
+  UINTN Addend = 0x3a3a3a3a12121212;
+  UINTN Result = 0;
+
+  //
+  // If the result of addition doesn't overflow MAX_UINTN, then it's addition
+  //
+  Status = SafeUintnAdd(Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x7474747424242424, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Augend = 0xababababefefefef;
+  Addend = 0xbcbcbcbcdededede;
+  Status = SafeUintnAdd(Augend, Addend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+
+  Status = SafeUintnAdd(Augend, Addend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeIntnAdd_64 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INTN Augend = 0x3a3a3a3a3a3a3a3a;
+  INTN Addend = 0x3a3a3a3a3a3a3a3a;
+  INTN Result = 0;
+
+  //
+  // If the result of addition doesn't overflow MAX_INTN
+  // and doesn't underflow MIN_INTN, then it's addition
+  //
+  Status = SafeIntnAdd(Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x7474747474747474, Result);
+
+  Augend = (-4195730024608447034);
+  Addend = (-4195730024608447034);
+  Status = SafeIntnAdd(Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL((-8391460049216894068), Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Augend = 0x5a5a5a5a5a5a5a5a;
+  Addend = 0x5a5a5a5a5a5a5a5a;
+  Status = SafeIntnAdd(Augend, Addend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+
+  Augend = (-6510615555426900570);
+  Addend = (-6510615555426900570);
+  Status = SafeIntnAdd(Augend, Addend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+
+  Status = SafeIntnAdd(Augend, Addend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnSub_64 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINTN Minuend = 0x5a5a5a5a5a5a5a5a;
+  UINTN Subtrahend = 0x3b3b3b3b3b3b3b3b;
+  UINTN Result = 0;
+
+  //
+  // If Minuend >= Subtrahend, then it's subtraction
+  //
+  Status = SafeUintnSub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x1f1f1f1f1f1f1f1f, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Minuend = 0x5a5a5a5a5a5a5a5a;
+  Subtrahend = 0x6d6d6d6d6d6d6d6d;
+  Status = SafeUintnSub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+
+  Status = SafeUintnSub(Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeIntnSub_64 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INTN Minuend = 0x5a5a5a5a5a5a5a5a;
+  INTN Subtrahend = 0x3a3a3a3a3a3a3a3a;
+  INTN Result = 0;
+
+  //
+  // If the result of subtractions doesn't overflow MAX_INTN or
+  // underflow MIN_INTN, then it's subtraction
+  //
+  Status = SafeIntnSub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x2020202020202020, Result);
+
+  Minuend = 0x3a3a3a3a3a3a3a3a;
+  Subtrahend = 0x5a5a5a5a5a5a5a5a;
+  Status = SafeIntnSub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL((-2314885530818453536), Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Minuend = (-8825501086245354106);
+  Subtrahend = 8825501086245354106;
+  Status = SafeIntnSub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+
+  Minuend = (8825501086245354106);
+  Subtrahend = (-8825501086245354106);
+  Status = SafeIntnSub(Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+
+  Status = SafeIntnSub(Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeUintnMult_64 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  UINTN Multiplicand = 0x123456789a;
+  UINTN Multiplier = 0x1234567;
+  UINTN Result = 0;
+
+  //
+  // If the result of multiplication doesn't overflow MAX_UINTN, it will succeed
+  //
+  Status = SafeUintnMult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x14b66db9745a07f6, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Multiplicand = 0x123456789a;
+  Multiplier = 0x12345678;
+  Status = SafeUintnMult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+
+  Status = SafeUintnMult(Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
+
+UNIT_TEST_STATUS
+EFIAPI
+TestSafeIntnMult_64 (
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,
+  IN UNIT_TEST_CONTEXT           Context
+  )
+{
+  EFI_STATUS  Status;
+  INTN Multiplicand = 0x123456789;
+  INTN Multiplier = 0x6789abcd;
+  INTN Result = 0;
+
+  //
+  // If the result of multiplication doesn't overflow MAX_INTN and doesn't
+  // underflow MIN_UINTN, it will succeed
+  //
+  Status = SafeIntnMult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR(Status);
+  UT_ASSERT_EQUAL(0x75cd9045220d6bb5, Result);
+
+  //
+  // Otherwise should result in an error status
+  //
+  Multiplicand = 0x123456789;
+  Multiplier = 0xa789abcd;
+  Status = SafeIntnMult(Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+
+  Status = SafeIntnMult(Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+
+  return UNIT_TEST_PASSED;
+}
-- 
2.14.2.windows.3



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [staging/edk2-test Patch 2/2] MdePkgUnitTest: Fix EDK II style issues
  2017-12-20  0:16 [staging/edk2-test Patch 0/2] MdePkgUnitTest: Add unit test package for MdePkg Kinney, Michael D
  2017-12-20  0:16 ` [staging/edk2-test Patch 1/2] " Kinney, Michael D
@ 2017-12-20  0:16 ` Kinney, Michael D
  2018-01-18  8:09 ` [staging/edk2-test Patch 0/2] MdePkgUnitTest: Add unit test package for MdePkg Sean Brogan
  2 siblings, 0 replies; 4+ messages in thread
From: Kinney, Michael D @ 2017-12-20  0:16 UTC (permalink / raw)
  To: edk2-devel; +Cc: Sean Brogan, Liming Gao, Michael D Kinney

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 .../SafeIntLib/SafeIntLibUintnIntnUnitTests32.c    |   60 +-
 .../SafeIntLib/SafeIntLibUintnIntnUnitTests64.c    |   60 +-
 .../SafeIntLib/SafeIntLibUintnIntnUnitTestsEbc.c   |   84 +-
 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.c    | 2625 +++++++++++---------
 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests32.c  |  404 +--
 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests64.c  |  404 +--
 6 files changed, 1967 insertions(+), 1670 deletions(-)

diff --git a/MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTests32.c b/MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTests32.c
index 632ddbbfef..2e39ee23ea 100644
--- a/MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTests32.c
+++ b/MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTests32.c
@@ -17,38 +17,38 @@
 
 #include "SafeIntLibUnitTests.h"
 
-#define _UNIT_TEST_32_BIT(CaseName) \
-UNIT_TEST_STATUS \
-EFIAPI \
-CaseName##_32 ( \
+#define _UNIT_TEST_32_BIT(CaseName)         \
+UNIT_TEST_STATUS                            \
+EFIAPI                                      \
+CaseName##_32 (                             \
   IN UNIT_TEST_FRAMEWORK_HANDLE  Framework, \
-  IN UNIT_TEST_CONTEXT           Context \
-  ); \
-\
-UNIT_TEST_STATUS \
-EFIAPI \
-CaseName ( \
+  IN UNIT_TEST_CONTEXT           Context    \
+  );                                        \
+                                            \
+UNIT_TEST_STATUS                            \
+EFIAPI                                      \
+CaseName (                                  \
   IN UNIT_TEST_FRAMEWORK_HANDLE  Framework, \
-  IN UNIT_TEST_CONTEXT           Context \
-  ) \
-{ \
+  IN UNIT_TEST_CONTEXT           Context    \
+  )                                         \
+{                                           \
   return CaseName##_32(Framework, Context); \
 }
 
-_UNIT_TEST_32_BIT(TestSafeInt32ToUintn)
-_UNIT_TEST_32_BIT(TestSafeUint32ToIntn)
-_UNIT_TEST_32_BIT(TestSafeIntnToInt32)
-_UNIT_TEST_32_BIT(TestSafeIntnToUint32)
-_UNIT_TEST_32_BIT(TestSafeUintnToUint32)
-_UNIT_TEST_32_BIT(TestSafeUintnToIntn)
-_UNIT_TEST_32_BIT(TestSafeUintnToInt64)
-_UNIT_TEST_32_BIT(TestSafeInt64ToIntn)
-_UNIT_TEST_32_BIT(TestSafeInt64ToUintn)
-_UNIT_TEST_32_BIT(TestSafeUint64ToIntn)
-_UNIT_TEST_32_BIT(TestSafeUint64ToUintn)
-_UNIT_TEST_32_BIT(TestSafeUintnAdd)
-_UNIT_TEST_32_BIT(TestSafeIntnAdd)
-_UNIT_TEST_32_BIT(TestSafeUintnSub)
-_UNIT_TEST_32_BIT(TestSafeIntnSub)
-_UNIT_TEST_32_BIT(TestSafeUintnMult)
-_UNIT_TEST_32_BIT(TestSafeIntnMult)
+_UNIT_TEST_32_BIT (TestSafeInt32ToUintn)
+_UNIT_TEST_32_BIT (TestSafeUint32ToIntn)
+_UNIT_TEST_32_BIT (TestSafeIntnToInt32)
+_UNIT_TEST_32_BIT (TestSafeIntnToUint32)
+_UNIT_TEST_32_BIT (TestSafeUintnToUint32)
+_UNIT_TEST_32_BIT (TestSafeUintnToIntn)
+_UNIT_TEST_32_BIT (TestSafeUintnToInt64)
+_UNIT_TEST_32_BIT (TestSafeInt64ToIntn)
+_UNIT_TEST_32_BIT (TestSafeInt64ToUintn)
+_UNIT_TEST_32_BIT (TestSafeUint64ToIntn)
+_UNIT_TEST_32_BIT (TestSafeUint64ToUintn)
+_UNIT_TEST_32_BIT (TestSafeUintnAdd)
+_UNIT_TEST_32_BIT (TestSafeIntnAdd)
+_UNIT_TEST_32_BIT (TestSafeUintnSub)
+_UNIT_TEST_32_BIT (TestSafeIntnSub)
+_UNIT_TEST_32_BIT (TestSafeUintnMult)
+_UNIT_TEST_32_BIT (TestSafeIntnMult)
diff --git a/MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTests64.c b/MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTests64.c
index 462f93e351..7d62b599ad 100644
--- a/MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTests64.c
+++ b/MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTests64.c
@@ -17,38 +17,38 @@
 
 #include "SafeIntLibUnitTests.h"
 
-#define _UNIT_TEST_64_BIT(CaseName) \
-UNIT_TEST_STATUS \
-EFIAPI \
-CaseName##_64 ( \
+#define _UNIT_TEST_64_BIT(CaseName)         \
+UNIT_TEST_STATUS                            \
+EFIAPI                                      \
+CaseName##_64 (                             \
   IN UNIT_TEST_FRAMEWORK_HANDLE  Framework, \
-  IN UNIT_TEST_CONTEXT           Context \
-  ); \
-\
-UNIT_TEST_STATUS \
-EFIAPI \
-CaseName ( \
+  IN UNIT_TEST_CONTEXT           Context    \
+  );                                        \
+                                            \
+UNIT_TEST_STATUS                            \
+EFIAPI                                      \
+CaseName (                                  \
   IN UNIT_TEST_FRAMEWORK_HANDLE  Framework, \
-  IN UNIT_TEST_CONTEXT           Context \
-  ) \
-{ \
+  IN UNIT_TEST_CONTEXT           Context    \
+  )                                         \
+{                                           \
   return CaseName##_64(Framework, Context); \
 }
 
-_UNIT_TEST_64_BIT(TestSafeInt32ToUintn)
-_UNIT_TEST_64_BIT(TestSafeUint32ToIntn)
-_UNIT_TEST_64_BIT(TestSafeIntnToInt32)
-_UNIT_TEST_64_BIT(TestSafeIntnToUint32)
-_UNIT_TEST_64_BIT(TestSafeUintnToUint32)
-_UNIT_TEST_64_BIT(TestSafeUintnToIntn)
-_UNIT_TEST_64_BIT(TestSafeUintnToInt64)
-_UNIT_TEST_64_BIT(TestSafeInt64ToIntn)
-_UNIT_TEST_64_BIT(TestSafeInt64ToUintn)
-_UNIT_TEST_64_BIT(TestSafeUint64ToIntn)
-_UNIT_TEST_64_BIT(TestSafeUint64ToUintn)
-_UNIT_TEST_64_BIT(TestSafeUintnAdd)
-_UNIT_TEST_64_BIT(TestSafeIntnAdd)
-_UNIT_TEST_64_BIT(TestSafeUintnSub)
-_UNIT_TEST_64_BIT(TestSafeIntnSub)
-_UNIT_TEST_64_BIT(TestSafeUintnMult)
-_UNIT_TEST_64_BIT(TestSafeIntnMult)
+_UNIT_TEST_64_BIT (TestSafeInt32ToUintn)
+_UNIT_TEST_64_BIT (TestSafeUint32ToIntn)
+_UNIT_TEST_64_BIT (TestSafeIntnToInt32)
+_UNIT_TEST_64_BIT (TestSafeIntnToUint32)
+_UNIT_TEST_64_BIT (TestSafeUintnToUint32)
+_UNIT_TEST_64_BIT (TestSafeUintnToIntn)
+_UNIT_TEST_64_BIT (TestSafeUintnToInt64)
+_UNIT_TEST_64_BIT (TestSafeInt64ToIntn)
+_UNIT_TEST_64_BIT (TestSafeInt64ToUintn)
+_UNIT_TEST_64_BIT (TestSafeUint64ToIntn)
+_UNIT_TEST_64_BIT (TestSafeUint64ToUintn)
+_UNIT_TEST_64_BIT (TestSafeUintnAdd)
+_UNIT_TEST_64_BIT (TestSafeIntnAdd)
+_UNIT_TEST_64_BIT (TestSafeUintnSub)
+_UNIT_TEST_64_BIT (TestSafeIntnSub)
+_UNIT_TEST_64_BIT (TestSafeUintnMult)
+_UNIT_TEST_64_BIT (TestSafeIntnMult)
diff --git a/MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTestsEbc.c b/MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTestsEbc.c
index e91811bc2f..98426f1c05 100644
--- a/MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTestsEbc.c
+++ b/MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTestsEbc.c
@@ -17,49 +17,49 @@
 
 #include "SafeIntLibUnitTests.h"
 
-#define _EBC_UNIT_TEST(CaseName) \
-UNIT_TEST_STATUS \
-EFIAPI \
-CaseName##_32 ( \
-  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework, \
-  IN UNIT_TEST_CONTEXT           Context \
-  ); \
-\
-UNIT_TEST_STATUS \
-EFIAPI \
-CaseName##_64 ( \
-  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework, \
-  IN UNIT_TEST_CONTEXT           Context \
-  ); \
-\
-UNIT_TEST_STATUS \
-EFIAPI \
-CaseName ( \
-  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework, \
-  IN UNIT_TEST_CONTEXT           Context \
-  ) \
-{ \
-  if (sizeof (UINTN) == sizeof (UINT32)) { \
+#define _EBC_UNIT_TEST(CaseName)              \
+UNIT_TEST_STATUS                              \
+EFIAPI                                        \
+CaseName##_32 (                               \
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,   \
+  IN UNIT_TEST_CONTEXT           Context      \
+  );                                          \
+                                              \
+UNIT_TEST_STATUS                              \
+EFIAPI                                        \
+CaseName##_64 (                               \
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,   \
+  IN UNIT_TEST_CONTEXT           Context      \
+  );                                          \
+                                              \
+UNIT_TEST_STATUS                              \
+EFIAPI                                        \
+CaseName (                                    \
+  IN UNIT_TEST_FRAMEWORK_HANDLE  Framework,   \
+  IN UNIT_TEST_CONTEXT           Context      \
+  )                                           \
+{                                             \
+  if (sizeof (UINTN) == sizeof (UINT32)) {    \
     return CaseName##_32(Framework, Context); \
-  } else { \
+  } else {                                    \
     return CaseName##_64(Framework, Context); \
-  } \
+  }                                           \
 }
 
-_EBC_UNIT_TEST(TestSafeInt32ToUintn)
-_EBC_UNIT_TEST(TestSafeUint32ToIntn)
-_EBC_UNIT_TEST(TestSafeIntnToInt32)
-_EBC_UNIT_TEST(TestSafeIntnToUint32)
-_EBC_UNIT_TEST(TestSafeUintnToUint32)
-_EBC_UNIT_TEST(TestSafeUintnToIntn)
-_EBC_UNIT_TEST(TestSafeUintnToInt64)
-_EBC_UNIT_TEST(TestSafeInt64ToIntn)
-_EBC_UNIT_TEST(TestSafeInt64ToUintn)
-_EBC_UNIT_TEST(TestSafeUint64ToIntn)
-_EBC_UNIT_TEST(TestSafeUint64ToUintn)
-_EBC_UNIT_TEST(TestSafeUintnAdd)
-_EBC_UNIT_TEST(TestSafeIntnAdd)
-_EBC_UNIT_TEST(TestSafeUintnSub)
-_EBC_UNIT_TEST(TestSafeIntnSub)
-_EBC_UNIT_TEST(TestSafeUintnMult)
-_EBC_UNIT_TEST(TestSafeIntnMult)
+_EBC_UNIT_TEST (TestSafeInt32ToUintn)
+_EBC_UNIT_TEST (TestSafeUint32ToIntn)
+_EBC_UNIT_TEST (TestSafeIntnToInt32)
+_EBC_UNIT_TEST (TestSafeIntnToUint32)
+_EBC_UNIT_TEST (TestSafeUintnToUint32)
+_EBC_UNIT_TEST (TestSafeUintnToIntn)
+_EBC_UNIT_TEST (TestSafeUintnToInt64)
+_EBC_UNIT_TEST (TestSafeInt64ToIntn)
+_EBC_UNIT_TEST (TestSafeInt64ToUintn)
+_EBC_UNIT_TEST (TestSafeUint64ToIntn)
+_EBC_UNIT_TEST (TestSafeUint64ToUintn)
+_EBC_UNIT_TEST (TestSafeUintnAdd)
+_EBC_UNIT_TEST (TestSafeIntnAdd)
+_EBC_UNIT_TEST (TestSafeUintnSub)
+_EBC_UNIT_TEST (TestSafeIntnSub)
+_EBC_UNIT_TEST (TestSafeUintnMult)
+_EBC_UNIT_TEST (TestSafeIntnMult)
diff --git a/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.c b/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.c
index 475c10c728..6640e3283a 100644
--- a/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.c
+++ b/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.c
@@ -41,26 +41,28 @@ TestSafeInt8ToUint8 (
   )
 {
   EFI_STATUS  Status;
-  INT8 Operand = 0x5b;
-  UINT8 Result = 0;
+  INT8        Operand;
+  UINT8       Result;
 
   //
   // Positive UINT8 should result in just a cast
   //
-  Status = SafeInt8ToUint8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeInt8ToUint8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   //
   // Negative number should result in an error status
   //
   Operand = (-56);
-  Status = SafeInt8ToUint8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+  Status = SafeInt8ToUint8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT8_ERROR, Result);
 
-  Status = SafeInt8ToUint8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt8ToUint8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -73,26 +75,28 @@ TestSafeInt8ToChar8 (
   )
 {
   EFI_STATUS  Status;
-  INT8 Operand = 0x5b;
-  CHAR8 Result = 0;
+  INT8        Operand;
+  CHAR8       Result;
 
   //
   // Positive INT8 should result in just a cast
   //
-  Status = SafeInt8ToChar8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeInt8ToChar8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   //
   // Negative number should result in an error status
   //
   Operand = (-56);
-  Status = SafeInt8ToChar8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeInt8ToChar8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
-  Status = SafeInt8ToChar8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt8ToChar8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -105,26 +109,28 @@ TestSafeInt8ToUint16 (
   )
 {
   EFI_STATUS  Status;
-  INT8 Operand = 0x5b;
-  UINT16 Result = 0;
+  INT8        Operand;
+  UINT16      Result;
 
   //
   // Positive UINT8 should result in just a cast
   //
-  Status = SafeInt8ToUint16(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeInt8ToUint16 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   //
   // Negative number should result in an error status
   //
   Operand = (-56);
-  Status = SafeInt8ToUint16(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+  Status = SafeInt8ToUint16 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT16_ERROR, Result);
 
-  Status = SafeInt8ToUint16(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt8ToUint16 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -137,26 +143,28 @@ TestSafeInt8ToUint32 (
   )
 {
   EFI_STATUS  Status;
-  INT8 Operand = 0x5b;
-  UINT32 Result = 0;
+  INT8        Operand;
+  UINT32      Result;
 
   //
   // Positive UINT8 should result in just a cast
   //
-  Status = SafeInt8ToUint32(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeInt8ToUint32 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   //
   // Negative number should result in an error status
   //
   Operand = (-56);
-  Status = SafeInt8ToUint32(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+  Status = SafeInt8ToUint32 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT32_ERROR, Result);
 
-  Status = SafeInt8ToUint32(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt8ToUint32 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -169,26 +177,28 @@ TestSafeInt8ToUintn (
   )
 {
   EFI_STATUS  Status;
-  INT8 Operand = 0x5b;
-  UINTN Result = 0;
+  INT8        Operand;
+  UINTN       Result;
 
   //
   // Positive UINT8 should result in just a cast
   //
-  Status = SafeInt8ToUintn(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeInt8ToUintn (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   //
   // Negative number should result in an error status
   //
   Operand = (-56);
-  Status = SafeInt8ToUintn(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+  Status = SafeInt8ToUintn (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINTN_ERROR, Result);
 
-  Status = SafeInt8ToUintn(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt8ToUintn (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -201,26 +211,28 @@ TestSafeInt8ToUint64 (
   )
 {
   EFI_STATUS  Status;
-  INT8 Operand = 0x5b;
-  UINT64 Result = 0;
+  INT8        Operand;
+  UINT64      Result;
 
   //
   // Positive UINT8 should result in just a cast
   //
-  Status = SafeInt8ToUint64(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeInt8ToUint64 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   //
   // Negative number should result in an error status
   //
   Operand = (-56);
-  Status = SafeInt8ToUint64(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT64_ERROR, Result);
+  Status = SafeInt8ToUint64 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT64_ERROR, Result);
 
-  Status = SafeInt8ToUint64(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt8ToUint64 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -233,26 +245,28 @@ TestSafeUint8ToInt8 (
   )
 {
   EFI_STATUS  Status;
-  UINT8 Operand = 0x5b;
-  INT8 Result = 0;
+  UINT8       Operand;
+  INT8        Result;
 
   //
   // Operand <= 0x7F (MAX_INT8) should result in a cast
   //
-  Status = SafeUint8ToInt8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeUint8ToInt8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   //
   // Operand larger than 0x7f should result in an error status
   //
   Operand = 0xaf;
-  Status = SafeUint8ToInt8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+  Status = SafeUint8ToInt8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT8_ERROR, Result);
 
-  Status = SafeUint8ToInt8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint8ToInt8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -265,8 +279,8 @@ TestSafeUint8ToChar8 (
   )
 {
   EFI_STATUS  Status;
-  UINT8 Operand = 0x5b;
-  CHAR8 Result = 0;
+  UINT8       Operand;
+  CHAR8       Result;
 
   //
   // CHAR8 is typedefed as char, which by default is signed, but is
@@ -276,20 +290,22 @@ TestSafeUint8ToChar8 (
   //
   // Operand <= 0x7F (MAX_INT8) should result in a cast
   //
-  Status = SafeUint8ToChar8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeUint8ToChar8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   //
   // Operand larger than 0x7f should result in an error status
   //
   Operand = 0xaf;
-  Status = SafeUint8ToChar8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeUint8ToChar8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
-  Status = SafeUint8ToChar8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint8ToChar8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -302,36 +318,38 @@ TestSafeInt16ToInt8 (
   )
 {
   EFI_STATUS  Status;
-  INT16 Operand = 0x5b;
-  INT8 Result = 0;
+  INT16       Operand;
+  INT8        Result;
 
   //
   // If Operand is between MIN_INT8 and MAX_INT8 inclusive, then it's a cast
   //
-  Status = SafeInt16ToInt8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeInt16ToInt8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   Operand = (-35);
-  Status = SafeInt16ToInt8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL((-35), Result);
+  Status = SafeInt16ToInt8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL ((-35), Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = 0x1234;
-  Status = SafeInt16ToInt8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+  Status = SafeInt16ToInt8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT8_ERROR, Result);
 
   Operand = (-17835);
-  Status = SafeInt16ToInt8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+  Status = SafeInt16ToInt8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT8_ERROR, Result);
 
-  Status = SafeInt16ToInt8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt16ToInt8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -344,8 +362,8 @@ TestSafeInt16ToChar8 (
   )
 {
   EFI_STATUS  Status;
-  INT16 Operand = 0x5b;
-  CHAR8 Result = 0;
+  INT16       Operand;
+  CHAR8       Result;
 
   //
   // CHAR8 is typedefed as char, which by default is signed, but is
@@ -355,30 +373,32 @@ TestSafeInt16ToChar8 (
   //
   // If Operand is between MIN_INT8 and MAX_INT8 inclusive, then it's a cast
   //
-  Status = SafeInt16ToChar8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeInt16ToChar8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (-35);
-  Status = SafeInt16ToChar8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeInt16ToChar8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
   Operand = 0x1234;
-  Status = SafeInt16ToChar8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeInt16ToChar8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
   Operand = (-17835);
-  Status = SafeInt16ToChar8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeInt16ToChar8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
-  Status = SafeInt16ToChar8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt16ToChar8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -391,31 +411,33 @@ TestSafeInt16ToUint8 (
   )
 {
   EFI_STATUS  Status;
-  INT16 Operand = 0x5b;
-  UINT8 Result = 0;
+  INT16       Operand;
+  UINT8       Result;
 
   //
   // If Operand is between 0 and MAX_INT8 inclusive, then it's a cast
   //
-  Status = SafeInt16ToUint8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeInt16ToUint8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = 0x1234;
-  Status = SafeInt16ToUint8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+  Status = SafeInt16ToUint8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT8_ERROR, Result);
 
   Operand = (-17835);
-  Status = SafeInt16ToUint8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+  Status = SafeInt16ToUint8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT8_ERROR, Result);
 
-  Status = SafeInt16ToUint8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt16ToUint8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -428,26 +450,28 @@ TestSafeInt16ToUint16 (
   )
 {
   EFI_STATUS  Status;
-  INT16 Operand = 0x5b5b;
-  UINT16 Result = 0;
+  INT16       Operand;
+  UINT16      Result;
 
   //
   // If Operand is non-negative, then it's a cast
   //
-  Status = SafeInt16ToUint16(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b5b, Result);
+  Result = 0;
+  Operand = 0x5b5b;
+  Status = SafeInt16ToUint16 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b5b, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (-17835);
-  Status = SafeInt16ToUint16(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+  Status = SafeInt16ToUint16 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT16_ERROR, Result);
 
-  Status = SafeInt16ToUint16(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt16ToUint16 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -460,26 +484,28 @@ TestSafeInt16ToUint32 (
   )
 {
   EFI_STATUS  Status;
-  INT16 Operand = 0x5b5b;
-  UINT32 Result = 0;
+  INT16       Operand;
+  UINT32      Result;
 
   //
   // If Operand is non-negative, then it's a cast
   //
-  Status = SafeInt16ToUint32(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b5b, Result);
+  Result = 0;
+  Operand = 0x5b5b;
+  Status = SafeInt16ToUint32 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b5b, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (-17835);
-  Status = SafeInt16ToUint32(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+  Status = SafeInt16ToUint32 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT32_ERROR, Result);
 
-  Status = SafeInt16ToUint32(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt16ToUint32 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -492,26 +518,28 @@ TestSafeInt16ToUintn (
   )
 {
   EFI_STATUS  Status;
-  INT16 Operand = 0x5b5b;
-  UINTN Result = 0;
+  INT16       Operand;
+  UINTN       Result;
 
   //
   // If Operand is non-negative, then it's a cast
   //
-  Status = SafeInt16ToUintn(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b5b, Result);
+  Result = 0;
+  Operand = 0x5b5b;
+  Status = SafeInt16ToUintn (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b5b, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (-17835);
-  Status = SafeInt16ToUintn(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+  Status = SafeInt16ToUintn (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINTN_ERROR, Result);
 
-  Status = SafeInt16ToUintn(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt16ToUintn (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -524,26 +552,28 @@ TestSafeInt16ToUint64 (
   )
 {
   EFI_STATUS  Status;
-  INT16 Operand = 0x5b5b;
-  UINT64 Result = 0;
+  INT16       Operand;
+  UINT64      Result;
 
   //
   // If Operand is non-negative, then it's a cast
   //
-  Status = SafeInt16ToUint64(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b5b, Result);
+  Result = 0;
+  Operand = 0x5b5b;
+  Status = SafeInt16ToUint64 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b5b, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (-17835);
-  Status = SafeInt16ToUint64(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT64_ERROR, Result);
+  Status = SafeInt16ToUint64 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT64_ERROR, Result);
 
-  Status = SafeInt16ToUint64(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt16ToUint64 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -556,26 +586,28 @@ TestSafeUint16ToInt8 (
   )
 {
   EFI_STATUS  Status;
-  UINT16 Operand = 0x5b;
-  INT8 Result = 0;
+  UINT16      Operand;
+  INT8        Result;
 
   //
   // If Operand is <= MAX_INT8, it's a cast
   //
-  Status = SafeUint16ToInt8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeUint16ToInt8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0x5b5b);
-  Status = SafeUint16ToInt8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+  Status = SafeUint16ToInt8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT8_ERROR, Result);
 
-  Status = SafeUint16ToInt8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint16ToInt8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -588,8 +620,8 @@ TestSafeUint16ToChar8 (
   )
 {
   EFI_STATUS  Status;
-  UINT16 Operand = 0x5b;
-  CHAR8 Result = 0;
+  UINT16      Operand;
+  CHAR8       Result;
 
   // CHAR8 is typedefed as char, which by default is signed, but is
   // also allowed to be unsigned.
@@ -597,20 +629,22 @@ TestSafeUint16ToChar8 (
   //
   // If Operand is <= MAX_INT8, it's a cast
   //
-  Status = SafeUint16ToChar8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeUint16ToChar8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0x5b5b);
-  Status = SafeUint16ToChar8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeUint16ToChar8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
-  Status = SafeUint16ToChar8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint16ToChar8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -623,26 +657,28 @@ TestSafeUint16ToUint8 (
   )
 {
   EFI_STATUS  Status;
-  UINT16 Operand = 0xab;
-  UINT8 Result = 0;
+  UINT16      Operand;
+  UINT8       Result;
 
   //
   // If Operand is <= MAX_UINT8 (0xff), it's a cast
   //
-  Status = SafeUint16ToUint8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xab, Result);
+  Result = 0;
+  Operand = 0xab;
+  Status = SafeUint16ToUint8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0x5b5b);
-  Status = SafeUint16ToUint8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+  Status = SafeUint16ToUint8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT8_ERROR, Result);
 
-  Status = SafeUint16ToUint8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint16ToUint8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -655,26 +691,28 @@ TestSafeUint16ToInt16 (
   )
 {
   EFI_STATUS  Status;
-  UINT16 Operand = 0x5b5b;
-  INT16 Result = 0;
+  UINT16      Operand;
+  INT16       Result;
 
   //
   // If Operand is <= MAX_INT16 (0x7fff), it's a cast
   //
-  Status = SafeUint16ToInt16(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b5b, Result);
+  Result = 0;
+  Operand = 0x5b5b;
+  Status = SafeUint16ToInt16 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b5b, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xabab);
-  Status = SafeUint16ToInt16(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+  Status = SafeUint16ToInt16 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT16_ERROR, Result);
 
-  Status = SafeUint16ToInt16(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint16ToInt16 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -687,36 +725,38 @@ TestSafeInt32ToInt8 (
   )
 {
   EFI_STATUS  Status;
-  INT32 Operand = 0x5b;
-  INT8 Result = 0;
+  INT32       Operand;
+  INT8        Result;
 
   //
   // If Operand is between MIN_INT8 and MAX_INT8 inclusive, then it's a cast
   //
-  Status = SafeInt32ToInt8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeInt32ToInt8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   Operand = (-57);
-  Status = SafeInt32ToInt8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL((-57), Result);
+  Status = SafeInt32ToInt8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL ((-57), Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0x5bababab);
-  Status = SafeInt32ToInt8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+  Status = SafeInt32ToInt8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT8_ERROR, Result);
 
   Operand = (-1537977259);
-  Status = SafeInt32ToInt8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+  Status = SafeInt32ToInt8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT8_ERROR, Result);
 
-  Status = SafeInt32ToInt8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt32ToInt8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -729,8 +769,8 @@ TestSafeInt32ToChar8 (
   )
 {
   EFI_STATUS  Status;
-  INT32 Operand = 0x5b;
-  CHAR8 Result = 0;
+  INT32       Operand;
+  CHAR8       Result;
 
   // CHAR8 is typedefed as char, which by default is signed, but is
   // also allowed to be unsigned.
@@ -738,30 +778,32 @@ TestSafeInt32ToChar8 (
   //
   // If Operand is between MIN_INT8 and MAX_INT8 inclusive, then it's a cast
   //
-  Status = SafeInt32ToChar8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeInt32ToChar8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (-57);
-  Status = SafeInt32ToChar8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeInt32ToChar8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
   Operand = (0x5bababab);
-  Status = SafeInt32ToChar8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeInt32ToChar8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
   Operand = (-1537977259);
-  Status = SafeInt32ToChar8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeInt32ToChar8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
-  Status = SafeInt32ToChar8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt32ToChar8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -774,36 +816,38 @@ TestSafeInt32ToUint8 (
   )
 {
   EFI_STATUS  Status;
-  INT32 Operand = 0x5b;
-  UINT8 Result = 0;
+  INT32       Operand;
+  UINT8       Result;
 
   //
   // If Operand is between 0 and MAX_INT8 inclusive, then it's a cast
   //
-  Status = SafeInt32ToUint8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeInt32ToUint8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (-57);
-  Status = SafeInt32ToUint8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+  Status = SafeInt32ToUint8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT8_ERROR, Result);
 
   Operand = (0x5bababab);
-  Status = SafeInt32ToUint8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+  Status = SafeInt32ToUint8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT8_ERROR, Result);
 
   Operand = (-1537977259);
-  Status = SafeInt32ToUint8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+  Status = SafeInt32ToUint8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT8_ERROR, Result);
 
-  Status = SafeInt32ToUint8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt32ToUint8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -816,36 +860,38 @@ TestSafeInt32ToInt16 (
   )
 {
   EFI_STATUS  Status;
-  INT32 Operand = 0x5b5b;
-  INT16 Result = 0;
+  INT32       Operand;
+  INT16       Result;
 
   //
   // If Operand is between MIN_INT16 and MAX_INT16 inclusive, then it's a cast
   //
-  Status = SafeInt32ToInt16(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b5b, Result);
+  Result = 0;
+  Operand = 0x5b5b;
+  Status = SafeInt32ToInt16 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b5b, Result);
 
   Operand = (-17857);
-  Status = SafeInt32ToInt16(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL((-17857), Result);
+  Status = SafeInt32ToInt16 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL ((-17857), Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0x5bababab);
-  Status = SafeInt32ToInt16(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+  Status = SafeInt32ToInt16 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT16_ERROR, Result);
 
   Operand = (-1537977259);
-  Status = SafeInt32ToInt16(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+  Status = SafeInt32ToInt16 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT16_ERROR, Result);
 
-  Status = SafeInt32ToInt16(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt32ToInt16 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -858,36 +904,38 @@ TestSafeInt32ToUint16 (
   )
 {
   EFI_STATUS  Status;
-  INT32 Operand = 0xabab;
-  UINT16 Result = 0;
+  INT32       Operand;
+  UINT16      Result;
 
   //
   // If Operand is between 0 and MAX_UINT16 inclusive, then it's a cast
   //
-  Status = SafeInt32ToUint16(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xabab, Result);
+  Result = 0;
+  Operand = 0xabab;
+  Status = SafeInt32ToUint16 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xabab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (-17857);
-  Status = SafeInt32ToUint16(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+  Status = SafeInt32ToUint16 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT16_ERROR, Result);
 
   Operand = (0x5bababab);
-  Status = SafeInt32ToUint16(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+  Status = SafeInt32ToUint16 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT16_ERROR, Result);
 
   Operand = (-1537977259);
-  Status = SafeInt32ToUint16(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+  Status = SafeInt32ToUint16 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT16_ERROR, Result);
 
-  Status = SafeInt32ToUint16(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt32ToUint16 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -900,26 +948,28 @@ TestSafeInt32ToUint32 (
   )
 {
   EFI_STATUS  Status;
-  INT32 Operand = 0x5bababab;
-  UINT32 Result = 0;
+  INT32       Operand;
+  UINT32      Result;
 
   //
   // If Operand is non-negative, then it's a cast
   //
-  Status = SafeInt32ToUint32(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5bababab, Result);
+  Result = 0;
+  Operand = 0x5bababab;
+  Status = SafeInt32ToUint32 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5bababab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (-1537977259);
-  Status = SafeInt32ToUint32(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+  Status = SafeInt32ToUint32 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT32_ERROR, Result);
 
-  Status = SafeInt32ToUint32(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt32ToUint32 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -932,26 +982,28 @@ TestSafeInt32ToUint64 (
   )
 {
   EFI_STATUS  Status;
-  INT32 Operand = 0x5bababab;
-  UINT64 Result = 0;
+  INT32       Operand;
+  UINT64      Result;
 
   //
   // If Operand is non-negative, then it's a cast
   //
-  Status = SafeInt32ToUint64(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5bababab, Result);
+  Result = 0;
+  Operand = 0x5bababab;
+  Status = SafeInt32ToUint64 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5bababab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (-1537977259);
-  Status = SafeInt32ToUint64(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT64_ERROR, Result);
+  Status = SafeInt32ToUint64 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT64_ERROR, Result);
 
-  Status = SafeInt32ToUint64(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt32ToUint64 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -964,26 +1016,28 @@ TestSafeUint32ToInt8 (
   )
 {
   EFI_STATUS  Status;
-  UINT32 Operand = 0x5b;
-  INT8 Result = 0;
+  UINT32      Operand;
+  INT8        Result;
 
   //
   // If Operand is <= MAX_INT8, then it's a cast
   //
-  Status = SafeUint32ToInt8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeUint32ToInt8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0x5bababab);
-  Status = SafeUint32ToInt8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+  Status = SafeUint32ToInt8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT8_ERROR, Result);
 
-  Status = SafeUint32ToInt8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint32ToInt8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -996,8 +1050,8 @@ TestSafeUint32ToChar8 (
   )
 {
   EFI_STATUS  Status;
-  UINT32 Operand = 0x5b;
-  CHAR8 Result = 0;
+  UINT32      Operand;
+  CHAR8       Result;
 
   // CHAR8 is typedefed as char, which by default is signed, but is
   // also allowed to be unsigned.
@@ -1005,20 +1059,22 @@ TestSafeUint32ToChar8 (
   //
   // If Operand is <= MAX_INT8, then it's a cast
   //
-  Status = SafeUint32ToChar8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeUint32ToChar8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0x5bababab);
-  Status = SafeUint32ToChar8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeUint32ToChar8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
-  Status = SafeUint32ToChar8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint32ToChar8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1031,26 +1087,28 @@ TestSafeUint32ToUint8 (
   )
 {
   EFI_STATUS  Status;
-  UINT32 Operand = 0xab;
-  UINT8 Result = 0;
+  UINT32      Operand;
+  UINT8       Result;
 
   //
   // If Operand is <= MAX_UINT8, then it's a cast
   //
-  Status = SafeUint32ToUint8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xab, Result);
+  Result = 0;
+  Operand = 0xab;
+  Status = SafeUint32ToUint8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xabababab);
-  Status = SafeUint32ToUint8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+  Status = SafeUint32ToUint8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT8_ERROR, Result);
 
-  Status = SafeUint32ToUint8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint32ToUint8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1063,26 +1121,28 @@ TestSafeUint32ToInt16 (
   )
 {
   EFI_STATUS  Status;
-  UINT32 Operand = 0x5bab;
-  INT16 Result = 0;
+  UINT32      Operand;
+  INT16       Result;
 
   //
   // If Operand is <= MAX_INT16, then it's a cast
   //
-  Status = SafeUint32ToInt16(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5bab, Result);
+  Result = 0;
+  Operand = 0x5bab;
+  Status = SafeUint32ToInt16 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5bab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xabababab);
-  Status = SafeUint32ToInt16(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+  Status = SafeUint32ToInt16 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT16_ERROR, Result);
 
-  Status = SafeUint32ToInt16(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint32ToInt16 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1095,26 +1155,28 @@ TestSafeUint32ToUint16 (
   )
 {
   EFI_STATUS  Status;
-  UINT32 Operand = 0xabab;
-  UINT16 Result = 0;
+  UINT32      Operand;
+  UINT16      Result;
 
   //
   // If Operand is <= MAX_UINT16, then it's a cast
   //
-  Status = SafeUint32ToUint16(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xabab, Result);
+  Result = 0;
+  Operand = 0xabab;
+  Status = SafeUint32ToUint16 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xabab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xabababab);
-  Status = SafeUint32ToUint16(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+  Status = SafeUint32ToUint16 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT16_ERROR, Result);
 
-  Status = SafeUint32ToUint16(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint32ToUint16 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1127,26 +1189,28 @@ TestSafeUint32ToInt32 (
   )
 {
   EFI_STATUS  Status;
-  UINT32 Operand = 0x5bababab;
-  INT32 Result = 0;
+  UINT32      Operand;
+  INT32       Result;
 
   //
   // If Operand is <= MAX_INT32, then it's a cast
   //
-  Status = SafeUint32ToInt32(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5bababab, Result);
+  Result = 0;
+  Operand = 0x5bababab;
+  Status = SafeUint32ToInt32 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5bababab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xabababab);
-  Status = SafeUint32ToInt32(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+  Status = SafeUint32ToInt32 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT32_ERROR, Result);
 
-  Status = SafeUint32ToInt32(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint32ToInt32 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1159,36 +1223,38 @@ TestSafeIntnToInt8 (
   )
 {
   EFI_STATUS  Status;
-  INTN Operand = 0x5b;
-  INT8 Result = 0;
+  INTN        Operand;
+  INT8        Result;
 
   //
   // If Operand is between MIN_INT8 and MAX_INT8 inclusive, then it's a cast
   //
-  Status = SafeIntnToInt8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeIntnToInt8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   Operand = (-53);
-  Status = SafeIntnToInt8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL((-53), Result);
+  Status = SafeIntnToInt8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL ((-53), Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0x5bababab);
-  Status = SafeIntnToInt8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+  Status = SafeIntnToInt8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT8_ERROR, Result);
 
   Operand = (-1537977259);
-  Status = SafeIntnToInt8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+  Status = SafeIntnToInt8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT8_ERROR, Result);
 
-  Status = SafeIntnToInt8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeIntnToInt8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1201,8 +1267,8 @@ TestSafeIntnToChar8 (
   )
 {
   EFI_STATUS  Status;
-  INTN Operand = 0x5b;
-  CHAR8 Result = 0;
+  INTN        Operand;
+  CHAR8       Result;
 
   // CHAR8 is typedefed as char, which by default is signed, but is
   // also allowed to be unsigned.
@@ -1210,30 +1276,32 @@ TestSafeIntnToChar8 (
   //
   // If Operand is between MIN_INT8 and MAX_INT8 inclusive, then it's a cast
   //
-  Status = SafeIntnToChar8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeIntnToChar8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (-53);
-  Status = SafeIntnToChar8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeIntnToChar8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
   Operand = (0x5bababab);
-  Status = SafeIntnToChar8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeIntnToChar8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
   Operand = (-1537977259);
-  Status = SafeIntnToChar8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeIntnToChar8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
-  Status = SafeIntnToChar8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeIntnToChar8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1246,31 +1314,33 @@ TestSafeIntnToUint8 (
   )
 {
   EFI_STATUS  Status;
-  INTN Operand = 0xab;
-  UINT8 Result = 0;
+  INTN        Operand;
+  UINT8       Result;
 
   //
   // If Operand is between 0 and MAX_UINT8 inclusive, then it's a cast
   //
-  Status = SafeIntnToUint8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xab, Result);
+  Result = 0;
+  Operand = 0xab;
+  Status = SafeIntnToUint8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0x5bababab);
-  Status = SafeIntnToUint8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+  Status = SafeIntnToUint8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT8_ERROR, Result);
 
   Operand = (-1537977259);
-  Status = SafeIntnToUint8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+  Status = SafeIntnToUint8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT8_ERROR, Result);
 
-  Status = SafeIntnToUint8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeIntnToUint8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1283,36 +1353,38 @@ TestSafeIntnToInt16 (
   )
 {
   EFI_STATUS  Status;
-  INTN Operand = 0x5bab;
-  INT16 Result = 0;
+  INTN        Operand;
+  INT16       Result;
 
   //
   // If Operand is between MIN_INT16 and MAX_INT16 inclusive, then it's a cast
   //
-  Status = SafeIntnToInt16(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5bab, Result);
+  Result = 0;
+  Operand = 0x5bab;
+  Status = SafeIntnToInt16 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5bab, Result);
 
   Operand = (-23467);
-  Status = SafeIntnToInt16(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL((-23467), Result);
+  Status = SafeIntnToInt16 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL ((-23467), Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0x5bababab);
-  Status = SafeIntnToInt16(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+  Status = SafeIntnToInt16 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT16_ERROR, Result);
 
   Operand = (-1537977259);
-  Status = SafeIntnToInt16(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+  Status = SafeIntnToInt16 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT16_ERROR, Result);
 
-  Status = SafeIntnToInt16(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeIntnToInt16 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1325,31 +1397,33 @@ TestSafeIntnToUint16 (
   )
 {
   EFI_STATUS  Status;
-  INTN Operand = 0xabab;
-  UINT16 Result = 0;
+  INTN        Operand;
+  UINT16      Result;
 
   //
   // If Operand is between 0 and MAX_UINT16 inclusive, then it's a cast
   //
-  Status = SafeIntnToUint16(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xabab, Result);
+  Result = 0;
+  Operand = 0xabab;
+  Status = SafeIntnToUint16 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xabab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0x5bababab);
-  Status = SafeIntnToUint16(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+  Status = SafeIntnToUint16 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT16_ERROR, Result);
 
   Operand = (-1537977259);
-  Status = SafeIntnToUint16(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+  Status = SafeIntnToUint16 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT16_ERROR, Result);
 
-  Status = SafeIntnToUint16(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeIntnToUint16 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1362,26 +1436,28 @@ TestSafeIntnToUintn (
   )
 {
   EFI_STATUS  Status;
-  INTN Operand = 0x5bababab;
-  UINTN Result = 0;
+  INTN        Operand;
+  UINTN       Result;
 
   //
   // If Operand is non-negative, then it's a cast
   //
-  Status = SafeIntnToUintn(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5bababab, Result);
+  Result = 0;
+  Operand = 0x5bababab;
+  Status = SafeIntnToUintn (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5bababab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (-1537977259);
-  Status = SafeIntnToUintn(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+  Status = SafeIntnToUintn (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINTN_ERROR, Result);
 
-  Status = SafeIntnToUintn(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeIntnToUintn (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1394,26 +1470,28 @@ TestSafeIntnToUint64 (
   )
 {
   EFI_STATUS  Status;
-  INTN Operand = 0x5bababab;
-  UINT64 Result = 0;
+  INTN        Operand;
+  UINT64      Result;
 
   //
   // If Operand is non-negative, then it's a cast
   //
-  Status = SafeIntnToUint64(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5bababab, Result);
+  Result = 0;
+  Operand = 0x5bababab;
+  Status = SafeIntnToUint64 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5bababab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (-1537977259);
-  Status = SafeIntnToUint64(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT64_ERROR, Result);
+  Status = SafeIntnToUint64 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT64_ERROR, Result);
 
-  Status = SafeIntnToUint64(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeIntnToUint64 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1426,26 +1504,28 @@ TestSafeUintnToInt8 (
   )
 {
   EFI_STATUS  Status;
-  UINTN Operand = 0x5b;
-  INT8 Result = 0;
+  UINTN       Operand;
+  INT8        Result;
 
   //
   // If Operand is <= MAX_INT8, then it's a cast
   //
-  Status = SafeUintnToInt8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeUintnToInt8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xabab);
-  Status = SafeUintnToInt8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+  Status = SafeUintnToInt8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT8_ERROR, Result);
 
-  Status = SafeUintnToInt8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUintnToInt8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1458,8 +1538,8 @@ TestSafeUintnToChar8 (
   )
 {
   EFI_STATUS  Status;
-  UINTN Operand = 0x5b;
-  CHAR8 Result = 0;
+  UINTN       Operand;
+  CHAR8       Result;
 
   // CHAR8 is typedefed as char, which by default is signed, but is
   // also allowed to be unsigned.
@@ -1467,20 +1547,22 @@ TestSafeUintnToChar8 (
   //
   // If Operand is <= MAX_INT8, then it's a cast
   //
-  Status = SafeUintnToChar8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeUintnToChar8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xabab);
-  Status = SafeUintnToChar8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeUintnToChar8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
-  Status = SafeUintnToChar8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUintnToChar8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1493,26 +1575,28 @@ TestSafeUintnToUint8 (
   )
 {
   EFI_STATUS  Status;
-  UINTN Operand = 0xab;
-  UINT8 Result = 0;
+  UINTN       Operand;
+  UINT8       Result;
 
   //
   // If Operand is <= MAX_UINT8, then it's a cast
   //
-  Status = SafeUintnToUint8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xab, Result);
+  Result = 0;
+  Operand = 0xab;
+  Status = SafeUintnToUint8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xabab);
-  Status = SafeUintnToUint8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+  Status = SafeUintnToUint8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT8_ERROR, Result);
 
-  Status = SafeUintnToUint8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUintnToUint8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1525,26 +1609,28 @@ TestSafeUintnToInt16 (
   )
 {
   EFI_STATUS  Status;
-  UINTN Operand = 0x5bab;
-  INT16 Result = 0;
+  UINTN       Operand;
+  INT16       Result;
 
   //
   // If Operand is <= MAX_INT16, then it's a cast
   //
-  Status = SafeUintnToInt16(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5bab, Result);
+  Result = 0;
+  Operand = 0x5bab;
+  Status = SafeUintnToInt16 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5bab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xabab);
-  Status = SafeUintnToInt16(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+  Status = SafeUintnToInt16 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT16_ERROR, Result);
 
-  Status = SafeUintnToInt16(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUintnToInt16 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1557,26 +1643,28 @@ TestSafeUintnToUint16 (
   )
 {
   EFI_STATUS  Status;
-  UINTN Operand = 0xabab;
-  UINT16 Result = 0;
+  UINTN       Operand;
+  UINT16      Result;
 
   //
   // If Operand is <= MAX_UINT16, then it's a cast
   //
-  Status = SafeUintnToUint16(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xabab, Result);
+  Result = 0;
+  Operand = 0xabab;
+  Status = SafeUintnToUint16 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xabab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xabababab);
-  Status = SafeUintnToUint16(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+  Status = SafeUintnToUint16 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT16_ERROR, Result);
 
-  Status = SafeUintnToUint16(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUintnToUint16 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1589,26 +1677,28 @@ TestSafeUintnToInt32 (
   )
 {
   EFI_STATUS  Status;
-  UINTN Operand = 0x5bababab;
-  INT32 Result = 0;
+  UINTN       Operand;
+  INT32       Result;
 
   //
   // If Operand is <= MAX_INT32, then it's a cast
   //
-  Status = SafeUintnToInt32(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5bababab, Result);
+  Result = 0;
+  Operand = 0x5bababab;
+  Status = SafeUintnToInt32 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5bababab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xabababab);
-  Status = SafeUintnToInt32(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+  Status = SafeUintnToInt32 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT32_ERROR, Result);
 
-  Status = SafeUintnToInt32(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUintnToInt32 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1621,36 +1711,38 @@ TestSafeInt64ToInt8 (
   )
 {
   EFI_STATUS  Status;
-  INT64 Operand = 0x5b;
-  INT8 Result = 0;
+  INT64       Operand;
+  INT8        Result;
 
   //
   // If Operand is between MIN_INT8 and  MAX_INT8 inclusive, then it's a cast
   //
-  Status = SafeInt64ToInt8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeInt64ToInt8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   Operand = (-37);
-  Status = SafeInt64ToInt8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL((-37), Result);
+  Status = SafeInt64ToInt8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL ((-37), Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0x5babababefefefef);
-  Status = SafeInt64ToInt8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+  Status = SafeInt64ToInt8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT8_ERROR, Result);
 
   Operand =  (-6605562033422200815);
-  Status = SafeInt64ToInt8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+  Status = SafeInt64ToInt8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT8_ERROR, Result);
 
-  Status = SafeInt64ToInt8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt64ToInt8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1663,8 +1755,8 @@ TestSafeInt64ToChar8 (
   )
 {
   EFI_STATUS  Status;
-  INT64 Operand = 0x5b;
-  CHAR8 Result = 0;
+  INT64       Operand;
+  CHAR8       Result;
 
   // CHAR8 is typedefed as char, which by default is signed, but is
   // also allowed to be unsigned.
@@ -1672,30 +1764,32 @@ TestSafeInt64ToChar8 (
   //
   // If Operand is between 0 and  MAX_INT8 inclusive, then it's a cast
   //
-  Status = SafeInt64ToChar8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeInt64ToChar8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (-37);
-  Status = SafeInt64ToChar8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeInt64ToChar8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
   Operand = (0x5babababefefefef);
-  Status = SafeInt64ToChar8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeInt64ToChar8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
   Operand =  (-6605562033422200815);
-  Status = SafeInt64ToChar8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeInt64ToChar8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
-  Status = SafeInt64ToChar8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt64ToChar8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1708,31 +1802,33 @@ TestSafeInt64ToUint8 (
   )
 {
   EFI_STATUS  Status;
-  INT64 Operand = 0xab;
-  UINT8 Result = 0;
+  INT64       Operand;
+  UINT8       Result;
 
   //
   // If Operand is between 0 and  MAX_UINT8 inclusive, then it's a cast
   //
-  Status = SafeInt64ToUint8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xab, Result);
+  Result = 0;
+  Operand = 0xab;
+  Status = SafeInt64ToUint8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0x5babababefefefef);
-  Status = SafeInt64ToUint8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+  Status = SafeInt64ToUint8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT8_ERROR, Result);
 
   Operand =  (-6605562033422200815);
-  Status = SafeInt64ToUint8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+  Status = SafeInt64ToUint8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT8_ERROR, Result);
 
-  Status = SafeInt64ToUint8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt64ToUint8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1745,36 +1841,38 @@ TestSafeInt64ToInt16 (
   )
 {
   EFI_STATUS  Status;
-  INT64 Operand = 0x5bab;
-  INT16 Result = 0;
+  INT64       Operand;
+  INT16       Result;
 
   //
   // If Operand is between MIN_INT16 and  MAX_INT16 inclusive, then it's a cast
   //
-  Status = SafeInt64ToInt16(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5bab, Result);
+  Result = 0;
+  Operand = 0x5bab;
+  Status = SafeInt64ToInt16 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5bab, Result);
 
   Operand = (-23467);
-  Status = SafeInt64ToInt16(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL((-23467), Result);
+  Status = SafeInt64ToInt16 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL ((-23467), Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0x5babababefefefef);
-  Status = SafeInt64ToInt16(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+  Status = SafeInt64ToInt16 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT16_ERROR, Result);
 
   Operand =  (-6605562033422200815);
-  Status = SafeInt64ToInt16(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+  Status = SafeInt64ToInt16 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT16_ERROR, Result);
 
-  Status = SafeInt64ToInt16(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt64ToInt16 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1787,31 +1885,33 @@ TestSafeInt64ToUint16 (
   )
 {
   EFI_STATUS  Status;
-  INT64 Operand = 0xabab;
-  UINT16 Result = 0;
+  INT64       Operand;
+  UINT16      Result;
 
   //
   // If Operand is between 0 and  MAX_UINT16 inclusive, then it's a cast
   //
-  Status = SafeInt64ToUint16(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xabab, Result);
+  Result = 0;
+  Operand = 0xabab;
+  Status = SafeInt64ToUint16 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xabab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0x5babababefefefef);
-  Status = SafeInt64ToUint16(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+  Status = SafeInt64ToUint16 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT16_ERROR, Result);
 
   Operand =  (-6605562033422200815);
-  Status = SafeInt64ToUint16(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+  Status = SafeInt64ToUint16 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT16_ERROR, Result);
 
-  Status = SafeInt64ToUint16(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt64ToUint16 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1824,36 +1924,38 @@ TestSafeInt64ToInt32 (
   )
 {
   EFI_STATUS  Status;
-  INT64 Operand = 0x5bababab;
-  INT32 Result = 0;
+  INT64       Operand;
+  INT32       Result;
 
   //
   // If Operand is between MIN_INT32 and  MAX_INT32 inclusive, then it's a cast
   //
-  Status = SafeInt64ToInt32(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5bababab, Result);
+  Result = 0;
+  Operand = 0x5bababab;
+  Status = SafeInt64ToInt32 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5bababab, Result);
 
   Operand = (-1537977259);
-  Status = SafeInt64ToInt32(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL((-1537977259), Result);
+  Status = SafeInt64ToInt32 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL ((-1537977259), Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0x5babababefefefef);
-  Status = SafeInt64ToInt32(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+  Status = SafeInt64ToInt32 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT32_ERROR, Result);
 
   Operand =  (-6605562033422200815);
-  Status = SafeInt64ToInt32(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+  Status = SafeInt64ToInt32 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT32_ERROR, Result);
 
-  Status = SafeInt64ToInt32(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt64ToInt32 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1866,31 +1968,33 @@ TestSafeInt64ToUint32 (
   )
 {
   EFI_STATUS  Status;
-  INT64 Operand = 0xabababab;
-  UINT32 Result = 0;
+  INT64       Operand;
+  UINT32      Result;
 
   //
   // If Operand is between 0 and  MAX_UINT32 inclusive, then it's a cast
   //
-  Status = SafeInt64ToUint32(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xabababab, Result);
+  Result = 0;
+  Operand = 0xabababab;
+  Status = SafeInt64ToUint32 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xabababab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0x5babababefefefef);
-  Status = SafeInt64ToUint32(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+  Status = SafeInt64ToUint32 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT32_ERROR, Result);
 
   Operand =  (-6605562033422200815);
-  Status = SafeInt64ToUint32(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+  Status = SafeInt64ToUint32 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT32_ERROR, Result);
 
-  Status = SafeInt64ToUint32(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt64ToUint32 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1903,26 +2007,28 @@ TestSafeInt64ToUint64 (
   )
 {
   EFI_STATUS  Status;
-  INT64 Operand = 0x5babababefefefef;
-  UINT64 Result = 0;
+  INT64       Operand;
+  UINT64      Result;
 
   //
   // If Operand is non-negative, then it's a cast
   //
-  Status = SafeInt64ToUint64(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5babababefefefef, Result);
+  Result = 0;
+  Operand = 0x5babababefefefef;
+  Status = SafeInt64ToUint64 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5babababefefefef, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand =  (-6605562033422200815);
-  Status = SafeInt64ToUint64(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT64_ERROR, Result);
+  Status = SafeInt64ToUint64 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT64_ERROR, Result);
 
-  Status = SafeInt64ToUint64(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt64ToUint64 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1935,26 +2041,28 @@ TestSafeUint64ToInt8 (
   )
 {
   EFI_STATUS  Status;
-  UINT64 Operand = 0x5b;
-  INT8 Result = 0;
+  UINT64      Operand;
+  INT8        Result;
 
   //
   // If Operand is <= MAX_INT8, then it's a cast
   //
-  Status = SafeUint64ToInt8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeUint64ToInt8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xababababefefefef);
-  Status = SafeUint64ToInt8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+  Status = SafeUint64ToInt8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT8_ERROR, Result);
 
-  Status = SafeUint64ToInt8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint64ToInt8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -1967,8 +2075,8 @@ TestSafeUint64ToChar8 (
   )
 {
   EFI_STATUS  Status;
-  UINT64 Operand = 0x5b;
-  CHAR8 Result = 0;
+  UINT64      Operand;
+  CHAR8       Result;
 
   // CHAR8 is typedefed as char, which by default is signed, but is
   // also allowed to be unsigned.
@@ -1976,20 +2084,22 @@ TestSafeUint64ToChar8 (
   //
   // If Operand is <= MAX_INT8, then it's a cast
   //
-  Status = SafeUint64ToChar8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5b, Result);
+  Result = 0;
+  Operand = 0x5b;
+  Status = SafeUint64ToChar8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5b, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xababababefefefef);
-  Status = SafeUint64ToChar8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeUint64ToChar8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
-  Status = SafeUint64ToChar8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint64ToChar8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2002,26 +2112,28 @@ TestSafeUint64ToUint8 (
   )
 {
   EFI_STATUS  Status;
-  UINT64 Operand = 0xab;
-  UINT8 Result = 0;
+  UINT64      Operand;
+  UINT8       Result;
 
   //
   // If Operand is <= MAX_UINT8, then it's a cast
   //
-  Status = SafeUint64ToUint8(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xab, Result);
+  Result = 0;
+  Operand = 0xab;
+  Status = SafeUint64ToUint8 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xababababefefefef);
-  Status = SafeUint64ToUint8(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+  Status = SafeUint64ToUint8 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT8_ERROR, Result);
 
-  Status = SafeUint64ToUint8(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint64ToUint8 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2034,26 +2146,28 @@ TestSafeUint64ToInt16 (
   )
 {
   EFI_STATUS  Status;
-  UINT64 Operand = 0x5bab;
-  INT16 Result = 0;
+  UINT64      Operand;
+  INT16       Result;
 
   //
   // If Operand is <= MAX_INT16, then it's a cast
   //
-  Status = SafeUint64ToInt16(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5bab, Result);
+  Result = 0;
+  Operand = 0x5bab;
+  Status = SafeUint64ToInt16 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5bab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xababababefefefef);
-  Status = SafeUint64ToInt16(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+  Status = SafeUint64ToInt16 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT16_ERROR, Result);
 
-  Status = SafeUint64ToInt16(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint64ToInt16 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2066,26 +2180,28 @@ TestSafeUint64ToUint16 (
   )
 {
   EFI_STATUS  Status;
-  UINT64 Operand = 0xabab;
-  UINT16 Result = 0;
+  UINT64      Operand;
+  UINT16      Result;
 
   //
   // If Operand is <= MAX_UINT16, then it's a cast
   //
-  Status = SafeUint64ToUint16(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xabab, Result);
+  Result = 0;
+  Operand = 0xabab;
+  Status = SafeUint64ToUint16 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xabab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xababababefefefef);
-  Status = SafeUint64ToUint16(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+  Status = SafeUint64ToUint16 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT16_ERROR, Result);
 
-  Status = SafeUint64ToUint16(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint64ToUint16 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2098,26 +2214,28 @@ TestSafeUint64ToInt32 (
   )
 {
   EFI_STATUS  Status;
-  UINT64 Operand = 0x5bababab;
-  INT32 Result = 0;
+  UINT64      Operand;
+  INT32       Result;
 
   //
   // If Operand is <= MAX_INT32, then it's a cast
   //
-  Status = SafeUint64ToInt32(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5bababab, Result);
+  Result = 0;
+  Operand = 0x5bababab;
+  Status = SafeUint64ToInt32 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5bababab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xababababefefefef);
-  Status = SafeUint64ToInt32(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+  Status = SafeUint64ToInt32 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT32_ERROR, Result);
 
-  Status = SafeUint64ToInt32(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint64ToInt32 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2130,26 +2248,28 @@ TestSafeUint64ToUint32 (
   )
 {
   EFI_STATUS  Status;
-  UINT64 Operand = 0xabababab;
-  UINT32 Result = 0;
+  UINT64      Operand;
+  UINT32      Result;
 
   //
   // If Operand is <= MAX_UINT32, then it's a cast
   //
-  Status = SafeUint64ToUint32(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xabababab, Result);
+  Result = 0;
+  Operand = 0xabababab;
+  Status = SafeUint64ToUint32 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xabababab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xababababefefefef);
-  Status = SafeUint64ToUint32(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+  Status = SafeUint64ToUint32 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT32_ERROR, Result);
 
-  Status = SafeUint64ToUint32(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint64ToUint32 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2162,26 +2282,28 @@ TestSafeUint64ToInt64 (
   )
 {
   EFI_STATUS  Status;
-  UINT64 Operand = 0x5babababefefefef;
-  INT64 Result = 0;
+  UINT64      Operand;
+  INT64       Result;
 
   //
   // If Operand is <= MAX_INT64, then it's a cast
   //
-  Status = SafeUint64ToInt64(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5babababefefefef, Result);
+  Result = 0;
+  Operand = 0x5babababefefefef;
+  Status = SafeUint64ToInt64 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5babababefefefef, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xababababefefefef);
-  Status = SafeUint64ToInt64(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT64_ERROR, Result);
+  Status = SafeUint64ToInt64 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT64_ERROR, Result);
 
-  Status = SafeUint64ToInt64(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint64ToInt64 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2197,28 +2319,31 @@ TestSafeUint8Add (
   )
 {
   EFI_STATUS  Status;
-  UINT8 Augend = 0x3a;
-  UINT8 Addend = 0x3a;
-  UINT8 Result = 0;
+  UINT8       Augend;
+  UINT8       Addend;
+  UINT8       Result;
 
   //
   // If the result of addition doesn't overflow MAX_UINT8, then it's addition
   //
-  Status = SafeUint8Add(Augend, Addend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x74, Result);
+  Result = 0;
+  Augend = 0x3a;
+  Addend = 0x3a;
+  Status = SafeUint8Add (Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x74, Result);
 
   //
   // Otherwise should result in an error status
   //
   Augend = 0xab;
   Addend = 0xbc;
-  Status = SafeUint8Add(Augend, Addend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+  Status = SafeUint8Add (Augend, Addend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT8_ERROR, Result);
 
-  Status = SafeUint8Add(Augend, Addend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint8Add (Augend, Addend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2231,28 +2356,31 @@ TestSafeUint16Add (
   )
 {
   EFI_STATUS  Status;
-  UINT16 Augend = 0x3a3a;
-  UINT16 Addend = 0x3a3a;
-  UINT16 Result = 0;
+  UINT16      Augend;
+  UINT16      Addend;
+  UINT16      Result;
 
   //
   // If the result of addition doesn't overflow MAX_UINT16, then it's addition
   //
-  Status = SafeUint16Add(Augend, Addend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x7474, Result);
+  Result = 0;
+  Augend = 0x3a3a;
+  Addend = 0x3a3a;
+  Status = SafeUint16Add (Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x7474, Result);
 
   //
   // Otherwise should result in an error status
   //
   Augend = 0xabab;
   Addend = 0xbcbc;
-  Status = SafeUint16Add(Augend, Addend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+  Status = SafeUint16Add (Augend, Addend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT16_ERROR, Result);
 
-  Status = SafeUint16Add(Augend, Addend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint16Add (Augend, Addend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2265,28 +2393,31 @@ TestSafeUint32Add (
   )
 {
   EFI_STATUS  Status;
-  UINT32 Augend = 0x3a3a3a3a;
-  UINT32 Addend = 0x3a3a3a3a;
-  UINT32 Result = 0;
+  UINT32      Augend;
+  UINT32      Addend;
+  UINT32      Result;
 
   //
   // If the result of addition doesn't overflow MAX_UINT32, then it's addition
   //
-  Status = SafeUint32Add(Augend, Addend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x74747474, Result);
+  Result = 0;
+  Augend = 0x3a3a3a3a;
+  Addend = 0x3a3a3a3a;
+  Status = SafeUint32Add (Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x74747474, Result);
 
   //
   // Otherwise should result in an error status
   //
   Augend = 0xabababab;
   Addend = 0xbcbcbcbc;
-  Status = SafeUint32Add(Augend, Addend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+  Status = SafeUint32Add (Augend, Addend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT32_ERROR, Result);
 
-  Status = SafeUint32Add(Augend, Addend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint32Add (Augend, Addend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2299,28 +2430,31 @@ TestSafeUint64Add (
   )
 {
   EFI_STATUS  Status;
-  UINT64 Augend = 0x3a3a3a3a12121212;
-  UINT64 Addend = 0x3a3a3a3a12121212;
-  UINT64 Result = 0;
+  UINT64      Augend;
+  UINT64      Addend;
+  UINT64      Result;
 
   //
   // If the result of addition doesn't overflow MAX_UINT64, then it's addition
   //
-  Status = SafeUint64Add(Augend, Addend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x7474747424242424, Result);
+  Result = 0;
+  Augend = 0x3a3a3a3a12121212;
+  Addend = 0x3a3a3a3a12121212;
+  Status = SafeUint64Add (Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x7474747424242424, Result);
 
   //
   // Otherwise should result in an error status
   //
   Augend = 0xababababefefefef;
   Addend = 0xbcbcbcbcdededede;
-  Status = SafeUint64Add(Augend, Addend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT64_ERROR, Result);
+  Status = SafeUint64Add (Augend, Addend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT64_ERROR, Result);
 
-  Status = SafeUint64Add(Augend, Addend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint64Add (Augend, Addend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2333,41 +2467,44 @@ TestSafeInt8Add (
   )
 {
   EFI_STATUS  Status;
-  INT8 Augend = 0x3a;
-  INT8 Addend = 0x3a;
-  INT8 Result = 0;
+  INT8        Augend;
+  INT8        Addend;
+  INT8        Result;
 
   //
   // If the result of addition doesn't overflow MAX_INT8
   // and doesn't underflow MIN_INT8, then it's addition
   //
-  Status = SafeInt8Add(Augend, Addend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x74, Result);
+  Result = 0;
+  Augend = 0x3a;
+  Addend = 0x3a;
+  Status = SafeInt8Add (Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x74, Result);
 
   Augend = (-58);
   Addend = (-58);
-  Status = SafeInt8Add(Augend, Addend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL((-116), Result);
+  Status = SafeInt8Add (Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL ((-116), Result);
 
   //
   // Otherwise should result in an error status
   //
   Augend = 0x5a;
   Addend = 0x5a;
-  Status = SafeInt8Add(Augend, Addend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+  Status = SafeInt8Add (Augend, Addend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT8_ERROR, Result);
 
   Augend = (-90);
   Addend = (-90);
-  Status = SafeInt8Add(Augend, Addend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+  Status = SafeInt8Add (Augend, Addend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT8_ERROR, Result);
 
-  Status = SafeInt8Add(Augend, Addend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt8Add (Augend, Addend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 
@@ -2381,41 +2518,44 @@ TestSafeChar8Add (
   )
 {
   EFI_STATUS  Status;
-  CHAR8 Augend = 0x3a;
-  CHAR8 Addend = 0x3a;
-  CHAR8 Result = 0;
+  CHAR8       Augend;
+  CHAR8       Addend;
+  CHAR8       Result;
 
   //
   // If the result of addition doesn't overflow MAX_INT8
   // and doesn't underflow MIN_INT8, then it's addition
   //
-  Status = SafeChar8Add(Augend, Addend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x74, Result);
+  Result = 0;
+  Augend = 0x3a;
+  Addend = 0x3a;
+  Status = SafeChar8Add (Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x74, Result);
 
   //
   // Otherwise should result in an error status
   //
   Augend = 0x5a;
   Addend = 0x5a;
-  Status = SafeChar8Add(Augend, Addend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeChar8Add (Augend, Addend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
   Augend = 0x85;
   Addend = 58;
-  Status = SafeChar8Add(Augend, Addend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeChar8Add (Augend, Addend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
   Augend = 58;
   Addend = 0x85;
-  Status = SafeChar8Add(Augend, Addend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeChar8Add (Augend, Addend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
-  Status = SafeChar8Add(Augend, Addend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeChar8Add (Augend, Addend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 
@@ -2429,41 +2569,44 @@ TestSafeInt16Add (
   )
 {
   EFI_STATUS  Status;
-  INT16 Augend = 0x3a3a;
-  INT16 Addend = 0x3a3a;
-  INT16 Result = 0;
+  INT16       Augend;
+  INT16       Addend;
+  INT16       Result;
 
   //
   // If the result of addition doesn't overflow MAX_INT16
   // and doesn't underflow MIN_INT16, then it's addition
   //
-  Status = SafeInt16Add(Augend, Addend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x7474, Result);
+  Result = 0;
+  Augend = 0x3a3a;
+  Addend = 0x3a3a;
+  Status = SafeInt16Add (Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x7474, Result);
 
   Augend = (-14906);
   Addend = (-14906);
-  Status = SafeInt16Add(Augend, Addend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL((-29812), Result);
+  Status = SafeInt16Add (Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL ((-29812), Result);
 
   //
   // Otherwise should result in an error status
   //
   Augend = 0x5a5a;
   Addend = 0x5a5a;
-  Status = SafeInt16Add(Augend, Addend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+  Status = SafeInt16Add (Augend, Addend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT16_ERROR, Result);
 
   Augend = (-23130);
   Addend = (-23130);
-  Status = SafeInt16Add(Augend, Addend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+  Status = SafeInt16Add (Augend, Addend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT16_ERROR, Result);
 
-  Status = SafeInt16Add(Augend, Addend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt16Add (Augend, Addend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2476,41 +2619,44 @@ TestSafeInt32Add (
   )
 {
   EFI_STATUS  Status;
-  INT32 Augend = 0x3a3a3a3a;
-  INT32 Addend = 0x3a3a3a3a;
-  INT32 Result = 0;
+  INT32       Augend;
+  INT32       Addend;
+  INT32       Result;
 
   //
   // If the result of addition doesn't overflow MAX_INT32
   // and doesn't underflow MIN_INT32, then it's addition
   //
-  Status = SafeInt32Add(Augend, Addend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x74747474, Result);
+  Result = 0;
+  Augend = 0x3a3a3a3a;
+  Addend = 0x3a3a3a3a;
+  Status = SafeInt32Add (Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x74747474, Result);
 
   Augend = (-976894522);
   Addend = (-976894522);
-  Status = SafeInt32Add(Augend, Addend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL((-1953789044), Result);
+  Status = SafeInt32Add (Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL ((-1953789044), Result);
 
   //
   // Otherwise should result in an error status
   //
   Augend = 0x5a5a5a5a;
   Addend = 0x5a5a5a5a;
-  Status = SafeInt32Add(Augend, Addend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+  Status = SafeInt32Add (Augend, Addend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT32_ERROR, Result);
 
   Augend = (-1515870810);
   Addend = (-1515870810);
-  Status = SafeInt32Add(Augend, Addend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+  Status = SafeInt32Add (Augend, Addend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT32_ERROR, Result);
 
-  Status = SafeInt32Add(Augend, Addend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt32Add (Augend, Addend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2523,41 +2669,44 @@ TestSafeInt64Add (
   )
 {
   EFI_STATUS  Status;
-  INT64 Augend = 0x3a3a3a3a3a3a3a3a;
-  INT64 Addend = 0x3a3a3a3a3a3a3a3a;
-  INT64 Result = 0;
+  INT64       Augend;
+  INT64       Addend;
+  INT64       Result;
 
   //
   // If the result of addition doesn't overflow MAX_INT64
   // and doesn't underflow MIN_INT64, then it's addition
   //
-  Status = SafeInt64Add(Augend, Addend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x7474747474747474, Result);
+  Result = 0;
+  Augend = 0x3a3a3a3a3a3a3a3a;
+  Addend = 0x3a3a3a3a3a3a3a3a;
+  Status = SafeInt64Add (Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x7474747474747474, Result);
 
   Augend = (-4195730024608447034);
   Addend = (-4195730024608447034);
-  Status = SafeInt64Add(Augend, Addend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL((-8391460049216894068), Result);
+  Status = SafeInt64Add (Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL ((-8391460049216894068), Result);
 
   //
   // Otherwise should result in an error status
   //
   Augend = 0x5a5a5a5a5a5a5a5a;
   Addend = 0x5a5a5a5a5a5a5a5a;
-  Status = SafeInt64Add(Augend, Addend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT64_ERROR, Result);
+  Status = SafeInt64Add (Augend, Addend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT64_ERROR, Result);
 
   Augend = (-6510615555426900570);
   Addend = (-6510615555426900570);
-  Status = SafeInt64Add(Augend, Addend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT64_ERROR, Result);
+  Status = SafeInt64Add (Augend, Addend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT64_ERROR, Result);
 
-  Status = SafeInt64Add(Augend, Addend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt64Add (Augend, Addend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2573,28 +2722,31 @@ TestSafeUint8Sub (
   )
 {
   EFI_STATUS  Status;
-  UINT8 Minuend = 0x5a;
-  UINT8 Subtrahend = 0x3b;
-  UINT8 Result = 0;
+  UINT8       Minuend;
+  UINT8       Subtrahend;
+  UINT8       Result;
 
   //
   // If Minuend >= Subtrahend, then it's subtraction
   //
-  Status = SafeUint8Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x1f, Result);
+  Result = 0;
+  Minuend = 0x5a;
+  Subtrahend = 0x3b;
+  Status = SafeUint8Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x1f, Result);
 
   //
   // Otherwise should result in an error status
   //
   Minuend = 0x5a;
   Subtrahend = 0x6d;
-  Status = SafeUint8Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+  Status = SafeUint8Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT8_ERROR, Result);
 
-  Status = SafeUint8Sub(Minuend, Subtrahend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint8Sub (Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2607,28 +2759,31 @@ TestSafeUint16Sub (
   )
 {
   EFI_STATUS  Status;
-  UINT16 Minuend = 0x5a5a;
-  UINT16 Subtrahend = 0x3b3b;
-  UINT16 Result = 0;
+  UINT16      Minuend;
+  UINT16      Subtrahend;
+  UINT16      Result;
 
   //
   // If Minuend >= Subtrahend, then it's subtraction
   //
-  Status = SafeUint16Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x1f1f, Result);
+  Result = 0;
+  Minuend = 0x5a5a;
+  Subtrahend = 0x3b3b;
+  Status = SafeUint16Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x1f1f, Result);
 
   //
   // Otherwise should result in an error status
   //
   Minuend = 0x5a5a;
   Subtrahend = 0x6d6d;
-  Status = SafeUint16Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+  Status = SafeUint16Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT16_ERROR, Result);
 
-  Status = SafeUint16Sub(Minuend, Subtrahend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint16Sub (Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2641,28 +2796,31 @@ TestSafeUint32Sub (
   )
 {
   EFI_STATUS  Status;
-  UINT32 Minuend = 0x5a5a5a5a;
-  UINT32 Subtrahend = 0x3b3b3b3b;
-  UINT32 Result = 0;
+  UINT32      Minuend;
+  UINT32      Subtrahend;
+  UINT32      Result;
 
   //
   // If Minuend >= Subtrahend, then it's subtraction
   //
-  Status = SafeUint32Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x1f1f1f1f, Result);
+  Result = 0;
+  Minuend = 0x5a5a5a5a;
+  Subtrahend = 0x3b3b3b3b;
+  Status = SafeUint32Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x1f1f1f1f, Result);
 
   //
   // Otherwise should result in an error status
   //
   Minuend = 0x5a5a5a5a;
   Subtrahend = 0x6d6d6d6d;
-  Status = SafeUint32Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+  Status = SafeUint32Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT32_ERROR, Result);
 
-  Status = SafeUint32Sub(Minuend, Subtrahend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint32Sub (Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2675,28 +2833,31 @@ TestSafeUint64Sub (
   )
 {
   EFI_STATUS  Status;
-  UINT64 Minuend = 0x5a5a5a5a5a5a5a5a;
-  UINT64 Subtrahend = 0x3b3b3b3b3b3b3b3b;
-  UINT64 Result = 0;
+  UINT64      Minuend;
+  UINT64      Subtrahend;
+  UINT64      Result;
 
   //
   // If Minuend >= Subtrahend, then it's subtraction
   //
-  Status = SafeUint64Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x1f1f1f1f1f1f1f1f, Result);
+  Result = 0;
+  Minuend = 0x5a5a5a5a5a5a5a5a;
+  Subtrahend = 0x3b3b3b3b3b3b3b3b;
+  Status = SafeUint64Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x1f1f1f1f1f1f1f1f, Result);
 
   //
   // Otherwise should result in an error status
   //
   Minuend = 0x5a5a5a5a5a5a5a5a;
   Subtrahend = 0x6d6d6d6d6d6d6d6d;
-  Status = SafeUint64Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT64_ERROR, Result);
+  Status = SafeUint64Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT64_ERROR, Result);
 
-  Status = SafeUint64Sub(Minuend, Subtrahend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint64Sub (Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2709,41 +2870,44 @@ TestSafeInt8Sub (
   )
 {
   EFI_STATUS  Status;
-  INT8 Minuend = 0x5a;
-  INT8 Subtrahend = 0x3a;
-  INT8 Result = 0;
+  INT8        Minuend;
+  INT8        Subtrahend;
+  INT8        Result;
 
   //
   // If the result of subtractions doesn't overflow MAX_INT8 or
   // underflow MIN_INT8, then it's subtraction
   //
-  Status = SafeInt8Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x20, Result);
+  Result = 0;
+  Minuend = 0x5a;
+  Subtrahend = 0x3a;
+  Status = SafeInt8Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x20, Result);
 
   Minuend = 58;
   Subtrahend = 78;
-  Status = SafeInt8Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL((-20), Result);
+  Status = SafeInt8Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL ((-20), Result);
 
   //
   // Otherwise should result in an error status
   //
   Minuend = (-80);
   Subtrahend = 80;
-  Status = SafeInt8Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+  Status = SafeInt8Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT8_ERROR, Result);
 
   Minuend = (80);
   Subtrahend = (-80);
-  Status = SafeInt8Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+  Status = SafeInt8Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT8_ERROR, Result);
 
-  Status = SafeInt8Sub(Minuend, Subtrahend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt8Sub (Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2756,41 +2920,44 @@ TestSafeChar8Sub (
   )
 {
   EFI_STATUS  Status;
-  CHAR8 Minuend = 0x5a;
-  CHAR8 Subtrahend = 0x3a;
-  CHAR8 Result = 0;
+  CHAR8       Minuend;
+  CHAR8       Subtrahend;
+  CHAR8       Result;
 
   //
   // If the result of subtractions doesn't overflow MAX_INT8 or
   // underflow MIN_INT8, then it's subtraction
   //
-  Status = SafeChar8Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x20, Result);
+  Result = 0;
+  Minuend = 0x5a;
+  Subtrahend = 0x3a;
+  Status = SafeChar8Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x20, Result);
 
   //
   // Otherwise should result in an error status
   //
   Minuend = 58;
   Subtrahend = 78;
-  Status = SafeChar8Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeChar8Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
   Minuend = 0x85;
   Subtrahend = 80;
-  Status = SafeChar8Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeChar8Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
   Minuend = (80);
   Subtrahend = 0x85;
-  Status = SafeChar8Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeChar8Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
-  Status = SafeChar8Sub(Minuend, Subtrahend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeChar8Sub (Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2803,41 +2970,44 @@ TestSafeInt16Sub (
   )
 {
   EFI_STATUS  Status;
-  INT16 Minuend = 0x5a5a;
-  INT16 Subtrahend = 0x3a3a;
-  INT16 Result = 0;
+  INT16       Minuend;
+  INT16       Subtrahend;
+  INT16       Result;
 
   //
   // If the result of subtractions doesn't overflow MAX_INT16 or
   // underflow MIN_INT16, then it's subtraction
   //
-  Status = SafeInt16Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x2020, Result);
+  Result = 0;
+  Minuend = 0x5a5a;
+  Subtrahend = 0x3a3a;
+  Status = SafeInt16Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x2020, Result);
 
   Minuend = 0x3a3a;
   Subtrahend = 0x5a5a;
-  Status = SafeInt16Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL((-8224), Result);
+  Status = SafeInt16Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL ((-8224), Result);
 
   //
   // Otherwise should result in an error status
   //
   Minuend = (-31354);
   Subtrahend = 31354;
-  Status = SafeInt16Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+  Status = SafeInt16Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT16_ERROR, Result);
 
   Minuend = (31354);
   Subtrahend = (-31354);
-  Status = SafeInt16Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+  Status = SafeInt16Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT16_ERROR, Result);
 
-  Status = SafeInt16Sub(Minuend, Subtrahend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt16Sub (Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2850,41 +3020,44 @@ TestSafeInt32Sub (
   )
 {
   EFI_STATUS  Status;
-  INT32 Minuend = 0x5a5a5a5a;
-  INT32 Subtrahend = 0x3a3a3a3a;
-  INT32 Result = 0;
+  INT32       Minuend;
+  INT32       Subtrahend;
+  INT32       Result;
 
   //
   // If the result of subtractions doesn't overflow MAX_INT32 or
   // underflow MIN_INT32, then it's subtraction
   //
-  Status = SafeInt32Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x20202020, Result);
+  Result = 0;
+  Minuend = 0x5a5a5a5a;
+  Subtrahend = 0x3a3a3a3a;
+  Status = SafeInt32Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x20202020, Result);
 
   Minuend = 0x3a3a3a3a;
   Subtrahend = 0x5a5a5a5a;
-  Status = SafeInt32Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL((-538976288), Result);
+  Status = SafeInt32Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL ((-538976288), Result);
 
   //
   // Otherwise should result in an error status
   //
   Minuend = (-2054847098);
   Subtrahend = 2054847098;
-  Status = SafeInt32Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+  Status = SafeInt32Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT32_ERROR, Result);
 
   Minuend = (2054847098);
   Subtrahend = (-2054847098);
-  Status = SafeInt32Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+  Status = SafeInt32Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT32_ERROR, Result);
 
-  Status = SafeInt32Sub(Minuend, Subtrahend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt32Sub (Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2897,41 +3070,44 @@ TestSafeInt64Sub (
   )
 {
   EFI_STATUS  Status;
-  INT64 Minuend = 0x5a5a5a5a5a5a5a5a;
-  INT64 Subtrahend = 0x3a3a3a3a3a3a3a3a;
-  INT64 Result = 0;
+  INT64       Minuend;
+  INT64       Subtrahend;
+  INT64       Result;
 
   //
   // If the result of subtractions doesn't overflow MAX_INT64 or
   // underflow MIN_INT64, then it's subtraction
   //
-  Status = SafeInt64Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x2020202020202020, Result);
+  Result = 0;
+  Minuend = 0x5a5a5a5a5a5a5a5a;
+  Subtrahend = 0x3a3a3a3a3a3a3a3a;
+  Status = SafeInt64Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x2020202020202020, Result);
 
   Minuend = 0x3a3a3a3a3a3a3a3a;
   Subtrahend = 0x5a5a5a5a5a5a5a5a;
-  Status = SafeInt64Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL((-2314885530818453536), Result);
+  Status = SafeInt64Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL ((-2314885530818453536), Result);
 
   //
   // Otherwise should result in an error status
   //
   Minuend = (-8825501086245354106);
   Subtrahend = 8825501086245354106;
-  Status = SafeInt64Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT64_ERROR, Result);
+  Status = SafeInt64Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT64_ERROR, Result);
 
   Minuend = (8825501086245354106);
   Subtrahend = (-8825501086245354106);
-  Status = SafeInt64Sub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT64_ERROR, Result);
+  Status = SafeInt64Sub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT64_ERROR, Result);
 
-  Status = SafeInt64Sub(Minuend, Subtrahend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt64Sub (Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2947,28 +3123,31 @@ TestSafeUint8Mult (
   )
 {
   EFI_STATUS  Status;
-  UINT8 Multiplicand = 0x12;
-  UINT8 Multiplier = 0xa;
-  UINT8 Result = 0;
+  UINT8       Multiplicand;
+  UINT8       Multiplier;
+  UINT8       Result;
 
   //
   // If the result of multiplication doesn't overflow MAX_UINT8, it will succeed
   //
-  Status = SafeUint8Mult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xb4, Result);
+  Result = 0;
+  Multiplicand = 0x12;
+  Multiplier = 0xa;
+  Status = SafeUint8Mult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xb4, Result);
 
   //
   // Otherwise should result in an error status
   //
   Multiplicand = 0x12;
   Multiplier = 0x23;
-  Status = SafeUint8Mult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT8_ERROR, Result);
+  Status = SafeUint8Mult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT8_ERROR, Result);
 
-  Status = SafeUint8Mult(Multiplicand, Multiplier, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint8Mult (Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -2981,28 +3160,31 @@ TestSafeUint16Mult (
   )
 {
   EFI_STATUS  Status;
-  UINT16 Multiplicand = 0x212;
-  UINT16 Multiplier = 0x7a;
-  UINT16 Result = 0;
+  UINT16      Multiplicand;
+  UINT16      Multiplier;
+  UINT16      Result;
 
   //
   // If the result of multiplication doesn't overflow MAX_UINT16, it will succeed
   //
-  Status = SafeUint16Mult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xfc94, Result);
+  Result = 0;
+  Multiplicand = 0x212;
+  Multiplier = 0x7a;
+  Status = SafeUint16Mult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xfc94, Result);
 
   //
   // Otherwise should result in an error status
   //
   Multiplicand = 0x1234;
   Multiplier = 0x213;
-  Status = SafeUint16Mult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT16_ERROR, Result);
+  Status = SafeUint16Mult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT16_ERROR, Result);
 
-  Status = SafeUint16Mult(Multiplicand, Multiplier, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint16Mult (Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -3015,28 +3197,31 @@ TestSafeUint32Mult (
   )
 {
   EFI_STATUS  Status;
-  UINT32 Multiplicand = 0xa122a;
-  UINT32 Multiplier = 0xd23;
-  UINT32 Result = 0;
+  UINT32      Multiplicand;
+  UINT32      Multiplier;
+  UINT32      Result;
 
   //
   // If the result of multiplication doesn't overflow MAX_UINT32, it will succeed
   //
-  Status = SafeUint32Mult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x844c9dbe, Result);
+  Result = 0;
+  Multiplicand = 0xa122a;
+  Multiplier = 0xd23;
+  Status = SafeUint32Mult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x844c9dbe, Result);
 
   //
   // Otherwise should result in an error status
   //
   Multiplicand = 0xa122a;
   Multiplier = 0xed23;
-  Status = SafeUint32Mult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+  Status = SafeUint32Mult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT32_ERROR, Result);
 
-  Status = SafeUint32Mult(Multiplicand, Multiplier, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint32Mult (Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -3049,28 +3234,31 @@ TestSafeUint64Mult (
   )
 {
   EFI_STATUS  Status;
-  UINT64 Multiplicand = 0x123456789a;
-  UINT64 Multiplier = 0x1234567;
-  UINT64 Result = 0;
+  UINT64      Multiplicand;
+  UINT64      Multiplier;
+  UINT64      Result;
 
   //
   // If the result of multiplication doesn't overflow MAX_UINT64, it will succeed
   //
-  Status = SafeUint64Mult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x14b66db9745a07f6, Result);
+  Result = 0;
+  Multiplicand = 0x123456789a;
+  Multiplier = 0x1234567;
+  Status = SafeUint64Mult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x14b66db9745a07f6, Result);
 
   //
   // Otherwise should result in an error status
   //
   Multiplicand = 0x123456789a;
   Multiplier = 0x12345678;
-  Status = SafeUint64Mult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT64_ERROR, Result);
+  Status = SafeUint64Mult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT64_ERROR, Result);
 
-  Status = SafeUint64Mult(Multiplicand, Multiplier, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint64Mult (Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -3083,29 +3271,32 @@ TestSafeInt8Mult (
   )
 {
   EFI_STATUS  Status;
-  INT8 Multiplicand = 0x12;
-  INT8 Multiplier = 0x7;
-  INT8 Result = 0;
+  INT8        Multiplicand;
+  INT8        Multiplier;
+  INT8        Result;
 
   //
   // If the result of multiplication doesn't overflow MAX_INT8 and doesn't
   // underflow MIN_UINT8, it will succeed
   //
-  Status = SafeInt8Mult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x7e, Result);
+  Result = 0;
+  Multiplicand = 0x12;
+  Multiplier = 0x7;
+  Status = SafeInt8Mult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x7e, Result);
 
   //
   // Otherwise should result in an error status
   //
   Multiplicand = 0x12;
   Multiplier = 0xa;
-  Status = SafeInt8Mult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT8_ERROR, Result);
+  Status = SafeInt8Mult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT8_ERROR, Result);
 
-  Status = SafeInt8Mult(Multiplicand, Multiplier, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt8Mult (Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -3118,41 +3309,44 @@ TestSafeChar8Mult (
   )
 {
   EFI_STATUS  Status;
-  CHAR8 Multiplicand = 0x12;
-  CHAR8 Multiplier = 0x7;
-  CHAR8 Result = 0;
+  CHAR8       Multiplicand;
+  CHAR8       Multiplier;
+  CHAR8       Result;
 
   //
   // If the result of multiplication doesn't overflow MAX_INT8 and doesn't
   // underflow MIN_UINT8, it will succeed
   //
-  Status = SafeChar8Mult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x7e, Result);
+  Result = 0;
+  Multiplicand = 0x12;
+  Multiplier = 0x7;
+  Status = SafeChar8Mult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x7e, Result);
 
   //
   // Otherwise should result in an error status
   //
   Multiplicand = 0x12;
   Multiplier = 0xa;
-  Status = SafeChar8Mult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeChar8Mult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
   Multiplicand = 0x85;
   Multiplier = 5;
-  Status = SafeChar8Mult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeChar8Mult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
   Multiplicand = 5;
   Multiplier = 0x85;
-  Status = SafeChar8Mult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(CHAR8_ERROR, Result);
+  Status = SafeChar8Mult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (CHAR8_ERROR, Result);
 
-  Status = SafeChar8Mult(Multiplicand, Multiplier, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeChar8Mult (Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -3165,29 +3359,32 @@ TestSafeInt16Mult (
   )
 {
   EFI_STATUS  Status;
-  INT16 Multiplicand = 0x123;
-  INT16 Multiplier = 0x67;
-  INT16 Result = 0;
+  INT16       Multiplicand;
+  INT16       Multiplier;
+  INT16       Result;
 
   //
   // If the result of multiplication doesn't overflow MAX_INT16 and doesn't
   // underflow MIN_UINT16, it will succeed
   //
-  Status = SafeInt16Mult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x7515, Result);
+  Multiplicand = 0x123;
+  Multiplier = 0x67;
+  Result = 0;
+  Status = SafeInt16Mult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x7515, Result);
 
   //
   // Otherwise should result in an error status
   //
   Multiplicand = 0x123;
   Multiplier = 0xab;
-  Status = SafeInt16Mult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT16_ERROR, Result);
+  Status = SafeInt16Mult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT16_ERROR, Result);
 
-  Status = SafeInt16Mult(Multiplicand, Multiplier, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt16Mult (Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -3200,29 +3397,32 @@ TestSafeInt32Mult (
   )
 {
   EFI_STATUS  Status;
-  INT32 Multiplicand = 0x123456;
-  INT32 Multiplier = 0x678;
-  INT32 Result = 0;
+  INT32       Multiplicand;
+  INT32       Multiplier;
+  INT32       Result;
 
   //
   // If the result of multiplication doesn't overflow MAX_INT32 and doesn't
   // underflow MIN_UINT32, it will succeed
   //
-  Status = SafeInt32Mult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x75c28c50, Result);
+  Result = 0;
+  Multiplicand = 0x123456;
+  Multiplier = 0x678;
+  Status = SafeInt32Mult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x75c28c50, Result);
 
   //
   // Otherwise should result in an error status
   //
   Multiplicand = 0x123456;
   Multiplier = 0xabc;
-  Status = SafeInt32Mult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+  Status = SafeInt32Mult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT32_ERROR, Result);
 
-  Status = SafeInt32Mult(Multiplicand, Multiplier, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt32Mult (Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -3235,29 +3435,32 @@ TestSafeInt64Mult (
   )
 {
   EFI_STATUS  Status;
-  INT64 Multiplicand = 0x123456789;
-  INT64 Multiplier = 0x6789abcd;
-  INT64 Result = 0;
+  INT64       Multiplicand;
+  INT64       Multiplier;
+  INT64       Result;
 
   //
   // If the result of multiplication doesn't overflow MAX_INT64 and doesn't
   // underflow MIN_UINT64, it will succeed
   //
-  Status = SafeInt64Mult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x75cd9045220d6bb5, Result);
+  Result = 0;
+  Multiplicand = 0x123456789;
+  Multiplier = 0x6789abcd;
+  Status = SafeInt64Mult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x75cd9045220d6bb5, Result);
 
   //
   // Otherwise should result in an error status
   //
   Multiplicand = 0x123456789;
   Multiplier = 0xa789abcd;
-  Status = SafeInt64Mult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT64_ERROR, Result);
+  Status = SafeInt64Mult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT64_ERROR, Result);
 
-  Status = SafeInt64Mult(Multiplicand, Multiplier, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt64Mult (Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -3272,8 +3475,8 @@ TestSafeInt64Mult (
 EFI_STATUS
 EFIAPI
 UefiMain (
-  IN EFI_HANDLE         ImageHandle,
-  IN EFI_SYSTEM_TABLE*  SystemTable
+  IN EFI_HANDLE        ImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS  Status;
@@ -3284,166 +3487,180 @@ UefiMain (
   CHAR16  ShortName[100];
   ShortName[0] = L'\0';
 
-  UnicodeSPrint(&ShortName[0], sizeof(ShortName), L"%a", gEfiCallerBaseName);
-  DEBUG((DEBUG_INFO, "%s v%s\n", UNIT_TEST_APP_NAME, UNIT_TEST_APP_VERSION));
+  UnicodeSPrint (&ShortName[0], sizeof (ShortName), L"%a", gEfiCallerBaseName);
+  DEBUG ((DEBUG_INFO, "%s v%s\n", UNIT_TEST_APP_NAME, UNIT_TEST_APP_VERSION));
 
   //
   // Start setting up the test framework for running the tests.
   //
-  Status = InitUnitTestFramework(&Fw, UNIT_TEST_APP_NAME, ShortName, UNIT_TEST_APP_VERSION);
-  if (EFI_ERROR(Status))
-  {
-    DEBUG((DEBUG_ERROR, "Failed in InitUnitTestFramework. Status = %r\n", Status));
+  Status = InitUnitTestFramework (&Fw, UNIT_TEST_APP_NAME, ShortName, UNIT_TEST_APP_VERSION);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "Failed in InitUnitTestFramework. Status = %r\n", Status));
     goto EXIT;
   }
 
   ///
   // Test the conversion functions
   //
-  Status = CreateUnitTestSuite(&ConversionTestSuite, Fw, L"Int Safe Conversions Test Suite", L"Common.IntSafe.Convert", NULL, NULL);
-  if (EFI_ERROR(Status))
-  {
-    DEBUG((DEBUG_ERROR, "Failed in CreateUnitTestSuite for Conversions Test Suite\n"));
+  Status = CreateUnitTestSuite (
+             &ConversionTestSuite,
+             Fw,
+             L"Int Safe Conversions Test Suite",
+             L"Common.IntSafe.Convert",
+             NULL, NULL
+             );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "Failed in CreateUnitTestSuite for Conversions Test Suite\n"));
     Status = EFI_OUT_OF_RESOURCES;
     goto EXIT;
   }
-  AddTestCase(ConversionTestSuite, L"Test SafeInt8ToUint8",    L"Common.IntSafe.Convert.TestSafeInt8ToUint8",    TestSafeInt8ToUint8,    NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt8ToChar8",    L"Common.IntSafe.Convert.TestSafeInt8ToChar8",    TestSafeInt8ToChar8,    NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt8ToUint16",   L"Common.IntSafe.Convert.TestSafeInt8ToUint16",   TestSafeInt8ToUint16,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt8ToUint32",   L"Common.IntSafe.Convert.TestSafeInt8ToUint32",   TestSafeInt8ToUint32,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt8ToUintn",    L"Common.IntSafe.Convert.TestSafeInt8ToUintn",    TestSafeInt8ToUintn,    NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt8ToUint64",   L"Common.IntSafe.Convert.TestSafeInt8ToUint64",   TestSafeInt8ToUint64,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUint8ToInt8",    L"Common.IntSafe.Convert.TestSafeUint8ToInt8",    TestSafeUint8ToInt8,    NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUint8ToChar8",   L"Common.IntSafe.Convert.TestSafeUint8ToChar8",   TestSafeUint8ToChar8,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt16ToInt8",    L"Common.IntSafe.Convert.TestSafeInt16ToInt8",    TestSafeInt16ToInt8,    NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt16ToChar8",   L"Common.IntSafe.Convert.TestSafeInt16ToChar8",   TestSafeInt16ToChar8,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt16ToUint8",   L"Common.IntSafe.Convert.TestSafeInt16ToUint8",   TestSafeInt16ToUint8,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt16ToUint16",  L"Common.IntSafe.Convert.TestSafeInt16ToUint16",  TestSafeInt16ToUint16,  NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt16ToUint32",  L"Common.IntSafe.Convert.TestSafeInt16ToUint32",  TestSafeInt16ToUint32,  NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt16ToUintn",   L"Common.IntSafe.Convert.TestSafeInt16ToUintn",   TestSafeInt16ToUintn,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt16ToUint64",  L"Common.IntSafe.Convert.TestSafeInt16ToUint64",  TestSafeInt16ToUint64,  NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUint16ToInt8",   L"Common.IntSafe.Convert.TestSafeUint16ToInt8",   TestSafeUint16ToInt8,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUint16ToChar8",  L"Common.IntSafe.Convert.TestSafeUint16ToChar8",  TestSafeUint16ToChar8,  NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUint16ToUint8",  L"Common.IntSafe.Convert.TestSafeUint16ToUint8",  TestSafeUint16ToUint8,  NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUint16ToInt16",  L"Common.IntSafe.Convert.TestSafeUint16ToInt16",  TestSafeUint16ToInt16,  NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt32ToInt8",    L"Common.IntSafe.Convert.TestSafeInt32ToInt8",    TestSafeInt32ToInt8,    NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt32ToChar8",   L"Common.IntSafe.Convert.TestSafeInt32ToChar8",   TestSafeInt32ToChar8,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt32ToUint8",   L"Common.IntSafe.Convert.TestSafeInt32ToUint8",   TestSafeInt32ToUint8,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt32ToInt16",   L"Common.IntSafe.Convert.TestSafeInt32ToInt16",   TestSafeInt32ToInt16,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt32ToUint16",  L"Common.IntSafe.Convert.TestSafeInt32ToUint16",  TestSafeInt32ToUint16,  NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt32ToUint32",  L"Common.IntSafe.Convert.TestSafeInt32ToUint32",  TestSafeInt32ToUint32,  NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt32ToUintn",   L"Common.IntSafe.Convert.TestSafeInt32ToUintn",   TestSafeInt32ToUintn,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt32ToUint64",  L"Common.IntSafe.Convert.TestSafeInt32ToUint64",  TestSafeInt32ToUint64,  NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUint32ToInt8",   L"Common.IntSafe.Convert.TestSafeUint32ToInt8",   TestSafeUint32ToInt8,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUint32ToChar8",  L"Common.IntSafe.Convert.TestSafeUint32ToChar8",  TestSafeUint32ToChar8,  NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUint32ToUint8",  L"Common.IntSafe.Convert.TestSafeUint32ToUint8",  TestSafeUint32ToUint8,  NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUint32ToInt16",  L"Common.IntSafe.Convert.TestSafeUint32ToInt16",  TestSafeUint32ToInt16,  NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUint32ToUint16", L"Common.IntSafe.Convert.TestSafeUint32ToUint16", TestSafeUint32ToUint16, NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUint32ToInt32",  L"Common.IntSafe.Convert.TestSafeUint32ToInt32",  TestSafeUint32ToInt32,  NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUint32ToIntn",   L"Common.IntSafe.Convert.TestSafeUint32ToIntn",   TestSafeUint32ToIntn,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeIntnToInt8",     L"Common.IntSafe.Convert.TestSafeIntnToInt8",     TestSafeIntnToInt8,     NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeIntnToChar8",    L"Common.IntSafe.Convert.TestSafeIntnToChar8",    TestSafeIntnToChar8,    NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeIntnToUint8",    L"Common.IntSafe.Convert.TestSafeIntnToUint8",    TestSafeIntnToUint8,    NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeIntnToInt16",    L"Common.IntSafe.Convert.TestSafeIntnToInt16",    TestSafeIntnToInt16,    NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeIntnToUint16",   L"Common.IntSafe.Convert.TestSafeIntnToUint16",   TestSafeIntnToUint16,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeIntnToInt32",    L"Common.IntSafe.Convert.TestSafeIntnToInt32",    TestSafeIntnToInt32,    NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeIntnToUint32",   L"Common.IntSafe.Convert.TestSafeIntnToUint32",   TestSafeIntnToUint32,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeIntnToUintn",    L"Common.IntSafe.Convert.TestSafeIntnToUintn",    TestSafeIntnToUintn,    NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeIntnToUint64",   L"Common.IntSafe.Convert.TestSafeIntnToUint64",   TestSafeIntnToUint64,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUintnToInt8",    L"Common.IntSafe.Convert.TestSafeUintnToInt8",    TestSafeUintnToInt8,    NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUintnToChar8",   L"Common.IntSafe.Convert.TestSafeUintnToChar8",   TestSafeUintnToChar8,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUintnToUint8",   L"Common.IntSafe.Convert.TestSafeUintnToUint8",   TestSafeUintnToUint8,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUintnToInt16",   L"Common.IntSafe.Convert.TestSafeUintnToInt16",   TestSafeUintnToInt16,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUintnToUint16",  L"Common.IntSafe.Convert.TestSafeUintnToUint16",  TestSafeUintnToUint16,  NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUintnToInt32",   L"Common.IntSafe.Convert.TestSafeUintnToInt32",   TestSafeUintnToInt32,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUintnToUint32",  L"Common.IntSafe.Convert.TestSafeUintnToUint32",  TestSafeUintnToUint32,  NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUintnToIntn",    L"Common.IntSafe.Convert.TestSafeUintnToIntn",    TestSafeUintnToIntn,    NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUintnToInt64",   L"Common.IntSafe.Convert.TestSafeUintnToInt64",   TestSafeUintnToInt64,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt64ToInt8",    L"Common.IntSafe.Convert.TestSafeInt64ToInt8",    TestSafeInt64ToInt8,    NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt64ToChar8",   L"Common.IntSafe.Convert.TestSafeInt64ToChar8",   TestSafeInt64ToChar8,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt64ToUint8",   L"Common.IntSafe.Convert.TestSafeInt64ToUint8",   TestSafeInt64ToUint8,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt64ToInt16",   L"Common.IntSafe.Convert.TestSafeInt64ToInt16",   TestSafeInt64ToInt16,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt64ToUint16",  L"Common.IntSafe.Convert.TestSafeInt64ToUint16",  TestSafeInt64ToUint16,  NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt64ToInt32",   L"Common.IntSafe.Convert.TestSafeInt64ToInt32",   TestSafeInt64ToInt32,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt64ToUint32",  L"Common.IntSafe.Convert.TestSafeInt64ToUint32",  TestSafeInt64ToUint32,  NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt64ToIntn",    L"Common.IntSafe.Convert.TestSafeInt64ToIntn",    TestSafeInt64ToIntn,    NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt64ToUintn",   L"Common.IntSafe.Convert.TestSafeInt64ToUintn",   TestSafeInt64ToUintn,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeInt64ToUint64",  L"Common.IntSafe.Convert.TestSafeInt64ToUint64",  TestSafeInt64ToUint64,  NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUint64ToInt8",   L"Common.IntSafe.Convert.TestSafeUint64ToInt8",   TestSafeUint64ToInt8,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUint64ToChar8",  L"Common.IntSafe.Convert.TestSafeUint64ToChar8",  TestSafeUint64ToChar8,  NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUint64ToUint8",  L"Common.IntSafe.Convert.TestSafeUint64ToUint8",  TestSafeUint64ToUint8,  NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUint64ToInt16",  L"Common.IntSafe.Convert.TestSafeUint64ToInt16",  TestSafeUint64ToInt16,  NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUint64ToUint16", L"Common.IntSafe.Convert.TestSafeUint64ToUint16", TestSafeUint64ToUint16, NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUint64ToInt32",  L"Common.IntSafe.Convert.TestSafeUint64ToInt32",  TestSafeUint64ToInt32,  NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUint64ToUint32", L"Common.IntSafe.Convert.TestSafeUint64ToUint32", TestSafeUint64ToUint32, NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUint64ToIntn",   L"Common.IntSafe.Convert.TestSafeUint64ToIntn",   TestSafeUint64ToIntn,   NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUint64ToUintn",  L"Common.IntSafe.Convert.TestSafeUint64ToUintn",  TestSafeUint64ToUintn,  NULL, NULL, NULL);
-  AddTestCase(ConversionTestSuite, L"Test SafeUint64ToInt64",  L"Common.IntSafe.Convert.TestSafeUint64ToInt64",  TestSafeUint64ToInt64,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt8ToUint8",    L"Common.IntSafe.Convert.TestSafeInt8ToUint8",    TestSafeInt8ToUint8,    NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt8ToChar8",    L"Common.IntSafe.Convert.TestSafeInt8ToChar8",    TestSafeInt8ToChar8,    NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt8ToUint16",   L"Common.IntSafe.Convert.TestSafeInt8ToUint16",   TestSafeInt8ToUint16,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt8ToUint32",   L"Common.IntSafe.Convert.TestSafeInt8ToUint32",   TestSafeInt8ToUint32,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt8ToUintn",    L"Common.IntSafe.Convert.TestSafeInt8ToUintn",    TestSafeInt8ToUintn,    NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt8ToUint64",   L"Common.IntSafe.Convert.TestSafeInt8ToUint64",   TestSafeInt8ToUint64,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUint8ToInt8",    L"Common.IntSafe.Convert.TestSafeUint8ToInt8",    TestSafeUint8ToInt8,    NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUint8ToChar8",   L"Common.IntSafe.Convert.TestSafeUint8ToChar8",   TestSafeUint8ToChar8,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt16ToInt8",    L"Common.IntSafe.Convert.TestSafeInt16ToInt8",    TestSafeInt16ToInt8,    NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt16ToChar8",   L"Common.IntSafe.Convert.TestSafeInt16ToChar8",   TestSafeInt16ToChar8,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt16ToUint8",   L"Common.IntSafe.Convert.TestSafeInt16ToUint8",   TestSafeInt16ToUint8,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt16ToUint16",  L"Common.IntSafe.Convert.TestSafeInt16ToUint16",  TestSafeInt16ToUint16,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt16ToUint32",  L"Common.IntSafe.Convert.TestSafeInt16ToUint32",  TestSafeInt16ToUint32,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt16ToUintn",   L"Common.IntSafe.Convert.TestSafeInt16ToUintn",   TestSafeInt16ToUintn,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt16ToUint64",  L"Common.IntSafe.Convert.TestSafeInt16ToUint64",  TestSafeInt16ToUint64,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUint16ToInt8",   L"Common.IntSafe.Convert.TestSafeUint16ToInt8",   TestSafeUint16ToInt8,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUint16ToChar8",  L"Common.IntSafe.Convert.TestSafeUint16ToChar8",  TestSafeUint16ToChar8,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUint16ToUint8",  L"Common.IntSafe.Convert.TestSafeUint16ToUint8",  TestSafeUint16ToUint8,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUint16ToInt16",  L"Common.IntSafe.Convert.TestSafeUint16ToInt16",  TestSafeUint16ToInt16,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt32ToInt8",    L"Common.IntSafe.Convert.TestSafeInt32ToInt8",    TestSafeInt32ToInt8,    NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt32ToChar8",   L"Common.IntSafe.Convert.TestSafeInt32ToChar8",   TestSafeInt32ToChar8,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt32ToUint8",   L"Common.IntSafe.Convert.TestSafeInt32ToUint8",   TestSafeInt32ToUint8,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt32ToInt16",   L"Common.IntSafe.Convert.TestSafeInt32ToInt16",   TestSafeInt32ToInt16,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt32ToUint16",  L"Common.IntSafe.Convert.TestSafeInt32ToUint16",  TestSafeInt32ToUint16,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt32ToUint32",  L"Common.IntSafe.Convert.TestSafeInt32ToUint32",  TestSafeInt32ToUint32,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt32ToUintn",   L"Common.IntSafe.Convert.TestSafeInt32ToUintn",   TestSafeInt32ToUintn,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt32ToUint64",  L"Common.IntSafe.Convert.TestSafeInt32ToUint64",  TestSafeInt32ToUint64,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUint32ToInt8",   L"Common.IntSafe.Convert.TestSafeUint32ToInt8",   TestSafeUint32ToInt8,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUint32ToChar8",  L"Common.IntSafe.Convert.TestSafeUint32ToChar8",  TestSafeUint32ToChar8,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUint32ToUint8",  L"Common.IntSafe.Convert.TestSafeUint32ToUint8",  TestSafeUint32ToUint8,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUint32ToInt16",  L"Common.IntSafe.Convert.TestSafeUint32ToInt16",  TestSafeUint32ToInt16,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUint32ToUint16", L"Common.IntSafe.Convert.TestSafeUint32ToUint16", TestSafeUint32ToUint16, NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUint32ToInt32",  L"Common.IntSafe.Convert.TestSafeUint32ToInt32",  TestSafeUint32ToInt32,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUint32ToIntn",   L"Common.IntSafe.Convert.TestSafeUint32ToIntn",   TestSafeUint32ToIntn,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeIntnToInt8",     L"Common.IntSafe.Convert.TestSafeIntnToInt8",     TestSafeIntnToInt8,     NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeIntnToChar8",    L"Common.IntSafe.Convert.TestSafeIntnToChar8",    TestSafeIntnToChar8,    NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeIntnToUint8",    L"Common.IntSafe.Convert.TestSafeIntnToUint8",    TestSafeIntnToUint8,    NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeIntnToInt16",    L"Common.IntSafe.Convert.TestSafeIntnToInt16",    TestSafeIntnToInt16,    NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeIntnToUint16",   L"Common.IntSafe.Convert.TestSafeIntnToUint16",   TestSafeIntnToUint16,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeIntnToInt32",    L"Common.IntSafe.Convert.TestSafeIntnToInt32",    TestSafeIntnToInt32,    NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeIntnToUint32",   L"Common.IntSafe.Convert.TestSafeIntnToUint32",   TestSafeIntnToUint32,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeIntnToUintn",    L"Common.IntSafe.Convert.TestSafeIntnToUintn",    TestSafeIntnToUintn,    NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeIntnToUint64",   L"Common.IntSafe.Convert.TestSafeIntnToUint64",   TestSafeIntnToUint64,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUintnToInt8",    L"Common.IntSafe.Convert.TestSafeUintnToInt8",    TestSafeUintnToInt8,    NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUintnToChar8",   L"Common.IntSafe.Convert.TestSafeUintnToChar8",   TestSafeUintnToChar8,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUintnToUint8",   L"Common.IntSafe.Convert.TestSafeUintnToUint8",   TestSafeUintnToUint8,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUintnToInt16",   L"Common.IntSafe.Convert.TestSafeUintnToInt16",   TestSafeUintnToInt16,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUintnToUint16",  L"Common.IntSafe.Convert.TestSafeUintnToUint16",  TestSafeUintnToUint16,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUintnToInt32",   L"Common.IntSafe.Convert.TestSafeUintnToInt32",   TestSafeUintnToInt32,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUintnToUint32",  L"Common.IntSafe.Convert.TestSafeUintnToUint32",  TestSafeUintnToUint32,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUintnToIntn",    L"Common.IntSafe.Convert.TestSafeUintnToIntn",    TestSafeUintnToIntn,    NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUintnToInt64",   L"Common.IntSafe.Convert.TestSafeUintnToInt64",   TestSafeUintnToInt64,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt64ToInt8",    L"Common.IntSafe.Convert.TestSafeInt64ToInt8",    TestSafeInt64ToInt8,    NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt64ToChar8",   L"Common.IntSafe.Convert.TestSafeInt64ToChar8",   TestSafeInt64ToChar8,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt64ToUint8",   L"Common.IntSafe.Convert.TestSafeInt64ToUint8",   TestSafeInt64ToUint8,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt64ToInt16",   L"Common.IntSafe.Convert.TestSafeInt64ToInt16",   TestSafeInt64ToInt16,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt64ToUint16",  L"Common.IntSafe.Convert.TestSafeInt64ToUint16",  TestSafeInt64ToUint16,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt64ToInt32",   L"Common.IntSafe.Convert.TestSafeInt64ToInt32",   TestSafeInt64ToInt32,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt64ToUint32",  L"Common.IntSafe.Convert.TestSafeInt64ToUint32",  TestSafeInt64ToUint32,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt64ToIntn",    L"Common.IntSafe.Convert.TestSafeInt64ToIntn",    TestSafeInt64ToIntn,    NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt64ToUintn",   L"Common.IntSafe.Convert.TestSafeInt64ToUintn",   TestSafeInt64ToUintn,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeInt64ToUint64",  L"Common.IntSafe.Convert.TestSafeInt64ToUint64",  TestSafeInt64ToUint64,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUint64ToInt8",   L"Common.IntSafe.Convert.TestSafeUint64ToInt8",   TestSafeUint64ToInt8,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUint64ToChar8",  L"Common.IntSafe.Convert.TestSafeUint64ToChar8",  TestSafeUint64ToChar8,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUint64ToUint8",  L"Common.IntSafe.Convert.TestSafeUint64ToUint8",  TestSafeUint64ToUint8,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUint64ToInt16",  L"Common.IntSafe.Convert.TestSafeUint64ToInt16",  TestSafeUint64ToInt16,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUint64ToUint16", L"Common.IntSafe.Convert.TestSafeUint64ToUint16", TestSafeUint64ToUint16, NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUint64ToInt32",  L"Common.IntSafe.Convert.TestSafeUint64ToInt32",  TestSafeUint64ToInt32,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUint64ToUint32", L"Common.IntSafe.Convert.TestSafeUint64ToUint32", TestSafeUint64ToUint32, NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUint64ToIntn",   L"Common.IntSafe.Convert.TestSafeUint64ToIntn",   TestSafeUint64ToIntn,   NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUint64ToUintn",  L"Common.IntSafe.Convert.TestSafeUint64ToUintn",  TestSafeUint64ToUintn,  NULL, NULL, NULL);
+  AddTestCase (ConversionTestSuite, L"Test SafeUint64ToInt64",  L"Common.IntSafe.Convert.TestSafeUint64ToInt64",  TestSafeUint64ToInt64,  NULL, NULL, NULL);
 
   //
   // Test the addition and subtraction functions
   //
-  Status = CreateUnitTestSuite(&AdditionSubtractionTestSuite, Fw, L"Int Safe Add/Subtract Test Suite", L"Common.IntSafe.AddSubtract", NULL, NULL);
-  if (EFI_ERROR(Status))
-  {
-    DEBUG((DEBUG_ERROR, "Failed in CreateUnitTestSuite for Int Safe Add/Subtract Test Suite\n"));
+  Status = CreateUnitTestSuite (
+             &AdditionSubtractionTestSuite,
+             Fw,
+             L"Int Safe Add/Subtract Test Suite",
+             L"Common.IntSafe.AddSubtract",
+             NULL,
+             NULL
+             );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "Failed in CreateUnitTestSuite for Int Safe Add/Subtract Test Suite\n"));
     Status = EFI_OUT_OF_RESOURCES;
     goto EXIT;
   }
-  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeUint8Add",  L"Common.IntSafe.AddSubtract.TestSafeUint8Add",  TestSafeUint8Add,  NULL, NULL, NULL);
-  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeUint16Add", L"Common.IntSafe.AddSubtract.TestSafeUint16Add", TestSafeUint16Add, NULL, NULL, NULL);
-  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeUint32Add", L"Common.IntSafe.AddSubtract.TestSafeUint32Add", TestSafeUint32Add, NULL, NULL, NULL);
-  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeUintnAdd",  L"Common.IntSafe.AddSubtract.TestSafeUintnAdd",  TestSafeUintnAdd,  NULL, NULL, NULL);
-  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeUint64Add", L"Common.IntSafe.AddSubtract.TestSafeUint64Add", TestSafeUint64Add, NULL, NULL, NULL);
-  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeInt8Add",   L"Common.IntSafe.AddSubtract.TestSafeInt8Add",   TestSafeInt8Add,   NULL, NULL, NULL);
-  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeChar8Add",  L"Common.IntSafe.AddSubtract.TestSafeChar8Add",  TestSafeChar8Add,  NULL, NULL, NULL);
-  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeInt16Add",  L"Common.IntSafe.AddSubtract.TestSafeInt16Add",  TestSafeInt16Add,  NULL, NULL, NULL);
-  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeInt32Add",  L"Common.IntSafe.AddSubtract.TestSafeInt32Add",  TestSafeInt32Add,  NULL, NULL, NULL);
-  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeIntnAdd",   L"Common.IntSafe.AddSubtract.TestSafeIntnAdd",   TestSafeIntnAdd,   NULL, NULL, NULL);
-  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeInt64Add",  L"Common.IntSafe.AddSubtract.TestSafeInt64Add",  TestSafeInt64Add,  NULL, NULL, NULL);
-  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeUint8Sub",  L"Common.IntSafe.AddSubtract.TestSafeUint8Sub",  TestSafeUint8Sub,  NULL, NULL, NULL);
-  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeUint16Sub", L"Common.IntSafe.AddSubtract.TestSafeUint16Sub", TestSafeUint16Sub, NULL, NULL, NULL);
-  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeUint32Sub", L"Common.IntSafe.AddSubtract.TestSafeUint32Sub", TestSafeUint32Sub, NULL, NULL, NULL);
-  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeUintnSub",  L"Common.IntSafe.AddSubtract.TestSafeUintnSub",  TestSafeUintnSub,  NULL, NULL, NULL);
-  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeUint64Sub", L"Common.IntSafe.AddSubtract.TestSafeUint64Sub", TestSafeUint64Sub, NULL, NULL, NULL);
-  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeInt8Sub",   L"Common.IntSafe.AddSubtract.TestSafeInt8Sub",   TestSafeInt8Sub,   NULL, NULL, NULL);
-  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeChar8Sub",  L"Common.IntSafe.AddSubtract.TestSafeChar8Sub",  TestSafeChar8Sub,  NULL, NULL, NULL);
-  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeInt16Sub",  L"Common.IntSafe.AddSubtract.TestSafeInt16Sub",  TestSafeInt16Sub,  NULL, NULL, NULL);
-  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeInt32Sub",  L"Common.IntSafe.AddSubtract.TestSafeInt32Sub",  TestSafeInt32Sub,  NULL, NULL, NULL);
-  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeIntnSub",   L"Common.IntSafe.AddSubtract.TestSafeIntnSub",   TestSafeIntnSub,   NULL, NULL, NULL);
-  AddTestCase(AdditionSubtractionTestSuite, L"Test SafeInt64Sub",  L"Common.IntSafe.AddSubtract.TestSafeInt64Sub",  TestSafeInt64Sub,  NULL, NULL, NULL);
+  AddTestCase (AdditionSubtractionTestSuite, L"Test SafeUint8Add",  L"Common.IntSafe.AddSubtract.TestSafeUint8Add",  TestSafeUint8Add,  NULL, NULL, NULL);
+  AddTestCase (AdditionSubtractionTestSuite, L"Test SafeUint16Add", L"Common.IntSafe.AddSubtract.TestSafeUint16Add", TestSafeUint16Add, NULL, NULL, NULL);
+  AddTestCase (AdditionSubtractionTestSuite, L"Test SafeUint32Add", L"Common.IntSafe.AddSubtract.TestSafeUint32Add", TestSafeUint32Add, NULL, NULL, NULL);
+  AddTestCase (AdditionSubtractionTestSuite, L"Test SafeUintnAdd",  L"Common.IntSafe.AddSubtract.TestSafeUintnAdd",  TestSafeUintnAdd,  NULL, NULL, NULL);
+  AddTestCase (AdditionSubtractionTestSuite, L"Test SafeUint64Add", L"Common.IntSafe.AddSubtract.TestSafeUint64Add", TestSafeUint64Add, NULL, NULL, NULL);
+  AddTestCase (AdditionSubtractionTestSuite, L"Test SafeInt8Add",   L"Common.IntSafe.AddSubtract.TestSafeInt8Add",   TestSafeInt8Add,   NULL, NULL, NULL);
+  AddTestCase (AdditionSubtractionTestSuite, L"Test SafeChar8Add",  L"Common.IntSafe.AddSubtract.TestSafeChar8Add",  TestSafeChar8Add,  NULL, NULL, NULL);
+  AddTestCase (AdditionSubtractionTestSuite, L"Test SafeInt16Add",  L"Common.IntSafe.AddSubtract.TestSafeInt16Add",  TestSafeInt16Add,  NULL, NULL, NULL);
+  AddTestCase (AdditionSubtractionTestSuite, L"Test SafeInt32Add",  L"Common.IntSafe.AddSubtract.TestSafeInt32Add",  TestSafeInt32Add,  NULL, NULL, NULL);
+  AddTestCase (AdditionSubtractionTestSuite, L"Test SafeIntnAdd",   L"Common.IntSafe.AddSubtract.TestSafeIntnAdd",   TestSafeIntnAdd,   NULL, NULL, NULL);
+  AddTestCase (AdditionSubtractionTestSuite, L"Test SafeInt64Add",  L"Common.IntSafe.AddSubtract.TestSafeInt64Add",  TestSafeInt64Add,  NULL, NULL, NULL);
+  AddTestCase (AdditionSubtractionTestSuite, L"Test SafeUint8Sub",  L"Common.IntSafe.AddSubtract.TestSafeUint8Sub",  TestSafeUint8Sub,  NULL, NULL, NULL);
+  AddTestCase (AdditionSubtractionTestSuite, L"Test SafeUint16Sub", L"Common.IntSafe.AddSubtract.TestSafeUint16Sub", TestSafeUint16Sub, NULL, NULL, NULL);
+  AddTestCase (AdditionSubtractionTestSuite, L"Test SafeUint32Sub", L"Common.IntSafe.AddSubtract.TestSafeUint32Sub", TestSafeUint32Sub, NULL, NULL, NULL);
+  AddTestCase (AdditionSubtractionTestSuite, L"Test SafeUintnSub",  L"Common.IntSafe.AddSubtract.TestSafeUintnSub",  TestSafeUintnSub,  NULL, NULL, NULL);
+  AddTestCase (AdditionSubtractionTestSuite, L"Test SafeUint64Sub", L"Common.IntSafe.AddSubtract.TestSafeUint64Sub", TestSafeUint64Sub, NULL, NULL, NULL);
+  AddTestCase (AdditionSubtractionTestSuite, L"Test SafeInt8Sub",   L"Common.IntSafe.AddSubtract.TestSafeInt8Sub",   TestSafeInt8Sub,   NULL, NULL, NULL);
+  AddTestCase (AdditionSubtractionTestSuite, L"Test SafeChar8Sub",  L"Common.IntSafe.AddSubtract.TestSafeChar8Sub",  TestSafeChar8Sub,  NULL, NULL, NULL);
+  AddTestCase (AdditionSubtractionTestSuite, L"Test SafeInt16Sub",  L"Common.IntSafe.AddSubtract.TestSafeInt16Sub",  TestSafeInt16Sub,  NULL, NULL, NULL);
+  AddTestCase (AdditionSubtractionTestSuite, L"Test SafeInt32Sub",  L"Common.IntSafe.AddSubtract.TestSafeInt32Sub",  TestSafeInt32Sub,  NULL, NULL, NULL);
+  AddTestCase (AdditionSubtractionTestSuite, L"Test SafeIntnSub",   L"Common.IntSafe.AddSubtract.TestSafeIntnSub",   TestSafeIntnSub,   NULL, NULL, NULL);
+  AddTestCase (AdditionSubtractionTestSuite, L"Test SafeInt64Sub",  L"Common.IntSafe.AddSubtract.TestSafeInt64Sub",  TestSafeInt64Sub,  NULL, NULL, NULL);
 
   //
   // Test the multiplication functions
   //
-  Status = CreateUnitTestSuite(&MultiplicationTestSuite, Fw, L"Int Safe Multiply Test Suite", L"Common.IntSafe.Multiply", NULL, NULL);
-  if (EFI_ERROR(Status))
-  {
-    DEBUG((DEBUG_ERROR, "Failed in CreateUnitTestSuite for Int Safe Multiply Test Suite\n"));
+  Status = CreateUnitTestSuite (
+             &MultiplicationTestSuite,
+             Fw,
+             L"Int Safe Multiply Test Suite",
+             L"Common.IntSafe.Multiply",
+             NULL, NULL
+             );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "Failed in CreateUnitTestSuite for Int Safe Multiply Test Suite\n"));
     Status = EFI_OUT_OF_RESOURCES;
     goto EXIT;
   }
-  AddTestCase(MultiplicationTestSuite, L"Test SafeUint8Mult",  L"Common.IntSafe.Multiply.TestSafeUint8Mult",  TestSafeUint8Mult,  NULL, NULL, NULL);
-  AddTestCase(MultiplicationTestSuite, L"Test SafeUint16Mult", L"Common.IntSafe.Multiply.TestSafeUint16Mult", TestSafeUint16Mult, NULL, NULL, NULL);
-  AddTestCase(MultiplicationTestSuite, L"Test SafeUint32Mult", L"Common.IntSafe.Multiply.TestSafeUint32Mult", TestSafeUint32Mult, NULL, NULL, NULL);
-  AddTestCase(MultiplicationTestSuite, L"Test SafeUintnMult",  L"Common.IntSafe.Multiply.TestSafeUintnMult",  TestSafeUintnMult,  NULL, NULL, NULL);
-  AddTestCase(MultiplicationTestSuite, L"Test SafeUint64Mult", L"Common.IntSafe.Multiply.TestSafeUint64Mult", TestSafeUint64Mult, NULL, NULL, NULL);
-  AddTestCase(MultiplicationTestSuite, L"Test SafeInt8Mult",   L"Common.IntSafe.Multiply.TestSafeInt8Mult",   TestSafeInt8Mult,   NULL, NULL, NULL);
-  AddTestCase(MultiplicationTestSuite, L"Test SafeChar8Mult",  L"Common.IntSafe.Multiply.TestSafeChar8Mult",  TestSafeChar8Mult,  NULL, NULL, NULL);
-  AddTestCase(MultiplicationTestSuite, L"Test SafeInt16Mult",  L"Common.IntSafe.Multiply.TestSafeInt16Mult",  TestSafeInt16Mult,  NULL, NULL, NULL);
-  AddTestCase(MultiplicationTestSuite, L"Test SafeInt32Mult",  L"Common.IntSafe.Multiply.TestSafeInt32Mult",  TestSafeInt32Mult,  NULL, NULL, NULL);
-  AddTestCase(MultiplicationTestSuite, L"Test SafeIntnMult",   L"Common.IntSafe.Multiply.TestSafeIntnMult",   TestSafeIntnMult,   NULL, NULL, NULL);
-  AddTestCase(MultiplicationTestSuite, L"Test SafeInt64Mult",  L"Common.IntSafe.Multiply.TestSafeInt64Mult",  TestSafeInt64Mult,  NULL, NULL, NULL);
+  AddTestCase (MultiplicationTestSuite, L"Test SafeUint8Mult",  L"Common.IntSafe.Multiply.TestSafeUint8Mult",  TestSafeUint8Mult,  NULL, NULL, NULL);
+  AddTestCase (MultiplicationTestSuite, L"Test SafeUint16Mult", L"Common.IntSafe.Multiply.TestSafeUint16Mult", TestSafeUint16Mult, NULL, NULL, NULL);
+  AddTestCase (MultiplicationTestSuite, L"Test SafeUint32Mult", L"Common.IntSafe.Multiply.TestSafeUint32Mult", TestSafeUint32Mult, NULL, NULL, NULL);
+  AddTestCase (MultiplicationTestSuite, L"Test SafeUintnMult",  L"Common.IntSafe.Multiply.TestSafeUintnMult",  TestSafeUintnMult,  NULL, NULL, NULL);
+  AddTestCase (MultiplicationTestSuite, L"Test SafeUint64Mult", L"Common.IntSafe.Multiply.TestSafeUint64Mult", TestSafeUint64Mult, NULL, NULL, NULL);
+  AddTestCase (MultiplicationTestSuite, L"Test SafeInt8Mult",   L"Common.IntSafe.Multiply.TestSafeInt8Mult",   TestSafeInt8Mult,   NULL, NULL, NULL);
+  AddTestCase (MultiplicationTestSuite, L"Test SafeChar8Mult",  L"Common.IntSafe.Multiply.TestSafeChar8Mult",  TestSafeChar8Mult,  NULL, NULL, NULL);
+  AddTestCase (MultiplicationTestSuite, L"Test SafeInt16Mult",  L"Common.IntSafe.Multiply.TestSafeInt16Mult",  TestSafeInt16Mult,  NULL, NULL, NULL);
+  AddTestCase (MultiplicationTestSuite, L"Test SafeInt32Mult",  L"Common.IntSafe.Multiply.TestSafeInt32Mult",  TestSafeInt32Mult,  NULL, NULL, NULL);
+  AddTestCase (MultiplicationTestSuite, L"Test SafeIntnMult",   L"Common.IntSafe.Multiply.TestSafeIntnMult",   TestSafeIntnMult,   NULL, NULL, NULL);
+  AddTestCase (MultiplicationTestSuite, L"Test SafeInt64Mult",  L"Common.IntSafe.Multiply.TestSafeInt64Mult",  TestSafeInt64Mult,  NULL, NULL, NULL);
 
   //
   // Execute the tests.
   //
-  Status = RunAllTestSuites(Fw);
+  Status = RunAllTestSuites (Fw);
 
 EXIT:
-  if (Fw)
-  {
-    FreeUnitTestFramework(Fw);
+  if (Fw) {
+    FreeUnitTestFramework (Fw);
   }
 
   return Status;
diff --git a/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests32.c b/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests32.c
index 242773b487..d86fa56068 100644
--- a/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests32.c
+++ b/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests32.c
@@ -36,26 +36,28 @@ TestSafeInt32ToUintn_32 (
   )
 {
   EFI_STATUS  Status;
-  INT32 Operand = 0x5bababab;
-  UINTN Result = 0;
+  INT32       Operand;
+  UINTN       Result;
 
   //
   // If Operand is non-negative, then it's a cast
   //
-  Status = SafeInt32ToUintn(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5bababab, Result);
+  Result = 0;
+  Operand = 0x5bababab;
+  Status = SafeInt32ToUintn (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5bababab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (-1537977259);
-  Status = SafeInt32ToUintn(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+  Status = SafeInt32ToUintn (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINTN_ERROR, Result);
 
-  Status = SafeInt32ToUintn(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt32ToUintn (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -68,26 +70,28 @@ TestSafeUint32ToIntn_32 (
   )
 {
   EFI_STATUS  Status;
-  UINT32 Operand = 0x5bababab;
-  INTN Result = 0;
+  UINT32      Operand;
+  INTN        Result;
 
   //
   // If Operand is <= MAX_INTN, then it's a cast
   //
-  Status = SafeUint32ToIntn(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5bababab, Result);
+  Result = 0;
+  Operand = 0x5bababab;
+  Status = SafeUint32ToIntn (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5bababab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xabababab);
-  Status = SafeUint32ToIntn(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+  Status = SafeUint32ToIntn (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INTN_ERROR, Result);
 
-  Status = SafeUint32ToIntn(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint32ToIntn (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -100,15 +104,17 @@ TestSafeIntnToInt32_32 (
   )
 {
   EFI_STATUS  Status;
-  INTN Operand = 0x5bababab;
-  INT32 Result = 0;
+  INTN        Operand;
+  INT32       Result;
 
   //
   // INTN is same as INT32 in IA32, so this is just a cast
   //
-  Status = SafeIntnToInt32(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5bababab, Result);
+  Result = 0;
+  Operand = 0x5bababab;
+  Status = SafeIntnToInt32 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5bababab, Result);
 
   return UNIT_TEST_PASSED;
 }
@@ -121,26 +127,28 @@ TestSafeIntnToUint32_32 (
   )
 {
   EFI_STATUS  Status;
-  INTN Operand = 0x5bababab;
-  UINT32 Result = 0;
+  INTN        Operand;
+  UINT32      Result;
 
   //
   // If Operand is non-negative, then it's a cast
   //
-  Status = SafeIntnToUint32(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5bababab, Result);
+  Result = 0;
+  Operand = 0x5bababab;
+  Status = SafeIntnToUint32 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5bababab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (-1537977259);
-  Status = SafeIntnToUint32(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+  Status = SafeIntnToUint32 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT32_ERROR, Result);
 
-  Status = SafeIntnToUint32(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeIntnToUint32 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -153,15 +161,17 @@ TestSafeUintnToUint32_32 (
   )
 {
   EFI_STATUS  Status;
-  UINTN Operand = 0xabababab;
-  UINT32 Result = 0;
+  UINTN       Operand;
+  UINT32      Result;
 
   //
   // UINTN is same as UINT32 in IA32, so this is just a cast
   //
-  Status = SafeUintnToUint32(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xabababab, Result);
+  Result = 0;
+  Operand = 0xabababab;
+  Status = SafeUintnToUint32 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xabababab, Result);
 
   return UNIT_TEST_PASSED;
 }
@@ -174,26 +184,28 @@ TestSafeUintnToIntn_32 (
   )
 {
   EFI_STATUS  Status;
-  UINTN Operand = 0x5bababab;
-  INTN Result = 0;
+  UINTN       Operand;
+  INTN        Result;
 
   //
   // If Operand is <= MAX_INTN, then it's a cast
   //
-  Status = SafeUintnToIntn(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5bababab, Result);
+  Result = 0;
+  Operand = 0x5bababab;
+  Status = SafeUintnToIntn (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5bababab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xabababab);
-  Status = SafeUintnToIntn(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+  Status = SafeUintnToIntn (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INTN_ERROR, Result);
 
-  Status = SafeUintnToIntn(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUintnToIntn (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -206,16 +218,18 @@ TestSafeUintnToInt64_32 (
   )
 {
   EFI_STATUS  Status;
-  UINTN Operand = 0xabababab;
-  INT64 Result = 0;
+  UINTN       Operand;
+  INT64       Result;
 
   //
   // UINTN is same as UINT32 in IA32, and UINT32 is a subset of
   // INT64, so this is just a cast
   //
-  Status = SafeUintnToInt64(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xabababab, Result);
+  Result = 0;
+  Operand = 0xabababab;
+  Status = SafeUintnToInt64 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xabababab, Result);
 
   return UNIT_TEST_PASSED;
 }
@@ -228,36 +242,38 @@ TestSafeInt64ToIntn_32 (
   )
 {
   EFI_STATUS  Status;
-  INT64 Operand = 0x5bababab;
-  INTN Result = 0;
+  INT64       Operand;
+  INTN        Result;
 
   //
   // If Operand is between MIN_INTN and  MAX_INTN2 inclusive, then it's a cast
   //
-  Status = SafeInt64ToIntn(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5bababab, Result);
+  Result = 0;
+  Operand = 0x5bababab;
+  Status = SafeInt64ToIntn (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5bababab, Result);
 
   Operand = (-1537977259);
-  Status = SafeInt64ToIntn(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL((-1537977259), Result);
+  Status = SafeInt64ToIntn (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL ((-1537977259), Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0x5babababefefefef);
-  Status = SafeInt64ToIntn(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+  Status = SafeInt64ToIntn (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INTN_ERROR, Result);
 
   Operand =  (-6605562033422200815);
-  Status = SafeInt64ToIntn(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+  Status = SafeInt64ToIntn (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INTN_ERROR, Result);
 
-  Status = SafeInt64ToIntn(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt64ToIntn (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -270,31 +286,33 @@ TestSafeInt64ToUintn_32 (
   )
 {
   EFI_STATUS  Status;
-  INT64 Operand = 0xabababab;
-  UINTN Result = 0;
+  INT64       Operand;
+  UINTN       Result;
 
   //
   // If Operand is between 0 and  MAX_UINTN inclusive, then it's a cast
   //
-  Status = SafeInt64ToUintn(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xabababab, Result);
+  Result = 0;
+  Operand = 0xabababab;
+  Status = SafeInt64ToUintn (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xabababab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0x5babababefefefef);
-  Status = SafeInt64ToUintn(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+  Status = SafeInt64ToUintn (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINTN_ERROR, Result);
 
   Operand =  (-6605562033422200815);
-  Status = SafeInt64ToUintn(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+  Status = SafeInt64ToUintn (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINTN_ERROR, Result);
 
-  Status = SafeInt64ToUintn(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt64ToUintn (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -307,26 +325,28 @@ TestSafeUint64ToIntn_32 (
   )
 {
   EFI_STATUS  Status;
-  UINT64 Operand = 0x5bababab;
-  INTN Result = 0;
+  UINT64      Operand;
+  INTN        Result;
 
   //
   // If Operand is <= MAX_INTN, then it's a cast
   //
-  Status = SafeUint64ToIntn(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5bababab, Result);
+  Result = 0;
+  Operand = 0x5bababab;
+  Status = SafeUint64ToIntn (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5bababab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xababababefefefef);
-  Status = SafeUint64ToIntn(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+  Status = SafeUint64ToIntn (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INTN_ERROR, Result);
 
-  Status = SafeUint64ToIntn(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint64ToIntn (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -339,26 +359,28 @@ TestSafeUint64ToUintn_32 (
   )
 {
   EFI_STATUS  Status;
-  UINT64 Operand = 0xabababab;
-  UINTN Result = 0;
+  UINT64      Operand;
+  UINTN       Result;
 
   //
   // If Operand is <= MAX_UINTN, then it's a cast
   //
-  Status = SafeUint64ToUintn(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xabababab, Result);
+  Result = 0;
+  Operand = 0xabababab;
+  Status = SafeUint64ToUintn (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xabababab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xababababefefefef);
-  Status = SafeUint64ToUintn(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+  Status = SafeUint64ToUintn (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINTN_ERROR, Result);
 
-  Status = SafeUint64ToUintn(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint64ToUintn (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -371,28 +393,31 @@ TestSafeUintnAdd_32 (
   )
 {
   EFI_STATUS  Status;
-  UINTN Augend = 0x3a3a3a3a;
-  UINTN Addend = 0x3a3a3a3a;
-  UINTN Result = 0;
+  UINTN       Augend;
+  UINTN       Addend;
+  UINTN       Result;
 
   //
   // If the result of addition doesn't overflow MAX_UINTN, then it's addition
   //
-  Status = SafeUintnAdd(Augend, Addend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x74747474, Result);
+  Result = 0;
+  Augend = 0x3a3a3a3a;
+  Addend = 0x3a3a3a3a;
+  Status = SafeUintnAdd (Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x74747474, Result);
 
   //
   // Otherwise should result in an error status
   //
   Augend = 0xabababab;
   Addend = 0xbcbcbcbc;
-  Status = SafeUintnAdd(Augend, Addend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+  Status = SafeUintnAdd (Augend, Addend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINTN_ERROR, Result);
 
-  Status = SafeUintnAdd(Augend, Addend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUintnAdd (Augend, Addend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -405,41 +430,44 @@ TestSafeIntnAdd_32 (
   )
 {
   EFI_STATUS  Status;
-  INTN Augend = 0x3a3a3a3a;
-  INTN Addend = 0x3a3a3a3a;
-  INTN Result = 0;
+  INTN        Augend;
+  INTN        Addend;
+  INTN        Result;
 
   //
   // If the result of addition doesn't overflow MAX_INTN
   // and doesn't underflow MIN_INTN, then it's addition
   //
-  Status = SafeIntnAdd(Augend, Addend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x74747474, Result);
+  Result = 0;
+  Augend = 0x3a3a3a3a;
+  Addend = 0x3a3a3a3a;
+  Status = SafeIntnAdd (Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x74747474, Result);
 
   Augend = (-976894522);
   Addend = (-976894522);
-  Status = SafeIntnAdd(Augend, Addend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL((-1953789044), Result);
+  Status = SafeIntnAdd (Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL ((-1953789044), Result);
 
   //
   // Otherwise should result in an error status
   //
   Augend = 0x5a5a5a5a;
   Addend = 0x5a5a5a5a;
-  Status = SafeIntnAdd(Augend, Addend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+  Status = SafeIntnAdd (Augend, Addend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INTN_ERROR, Result);
 
   Augend = (-1515870810);
   Addend = (-1515870810);
-  Status = SafeIntnAdd(Augend, Addend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+  Status = SafeIntnAdd (Augend, Addend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INTN_ERROR, Result);
 
-  Status = SafeIntnAdd(Augend, Addend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeIntnAdd (Augend, Addend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -452,28 +480,31 @@ TestSafeUintnSub_32 (
   )
 {
   EFI_STATUS  Status;
-  UINTN Minuend = 0x5a5a5a5a;
-  UINTN Subtrahend = 0x3b3b3b3b;
-  UINTN Result = 0;
+  UINTN       Minuend;
+  UINTN       Subtrahend;
+  UINTN       Result;
 
   //
   // If Minuend >= Subtrahend, then it's subtraction
   //
-  Status = SafeUintnSub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x1f1f1f1f, Result);
+  Result = 0;
+  Minuend = 0x5a5a5a5a;
+  Subtrahend = 0x3b3b3b3b;
+  Status = SafeUintnSub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x1f1f1f1f, Result);
 
   //
   // Otherwise should result in an error status
   //
   Minuend = 0x5a5a5a5a;
   Subtrahend = 0x6d6d6d6d;
-  Status = SafeUintnSub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+  Status = SafeUintnSub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINTN_ERROR, Result);
 
-  Status = SafeUintnSub(Minuend, Subtrahend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUintnSub (Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -486,41 +517,44 @@ TestSafeIntnSub_32 (
   )
 {
   EFI_STATUS  Status;
-  INTN Minuend = 0x5a5a5a5a;
-  INTN Subtrahend = 0x3a3a3a3a;
-  INTN Result = 0;
+  INTN        Minuend;
+  INTN        Subtrahend;
+  INTN        Result;
 
   //
   // If the result of subtractions doesn't overflow MAX_INTN or
   // underflow MIN_INTN, then it's subtraction
   //
-  Status = SafeIntnSub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x20202020, Result);
+  Result = 0;
+  Minuend = 0x5a5a5a5a;
+  Subtrahend = 0x3a3a3a3a;
+  Status = SafeIntnSub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x20202020, Result);
 
   Minuend = 0x3a3a3a3a;
   Subtrahend = 0x5a5a5a5a;
-  Status = SafeIntnSub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL((-538976288), Result);
+  Status = SafeIntnSub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL ((-538976288), Result);
 
   //
   // Otherwise should result in an error status
   //
   Minuend = (-2054847098);
   Subtrahend = 2054847098;
-  Status = SafeIntnSub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+  Status = SafeIntnSub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INTN_ERROR, Result);
 
   Minuend = (2054847098);
   Subtrahend = (-2054847098);
-  Status = SafeIntnSub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+  Status = SafeIntnSub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INTN_ERROR, Result);
 
-  Status = SafeIntnSub(Minuend, Subtrahend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeIntnSub (Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -533,28 +567,31 @@ TestSafeUintnMult_32 (
   )
 {
   EFI_STATUS  Status;
-  UINTN Multiplicand = 0xa122a;
-  UINTN Multiplier = 0xd23;
-  UINTN Result = 0;
+  UINTN       Multiplicand;
+  UINTN       Multiplier;
+  UINTN       Result;
 
   //
   // If the result of multiplication doesn't overflow MAX_UINTN, it will succeed
   //
-  Status = SafeUintnMult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x844c9dbe, Result);
+  Result = 0;
+  Multiplicand = 0xa122a;
+  Multiplier = 0xd23;
+  Status = SafeUintnMult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x844c9dbe, Result);
 
   //
   // Otherwise should result in an error status
   //
   Multiplicand = 0xa122a;
   Multiplier = 0xed23;
-  Status = SafeUintnMult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+  Status = SafeUintnMult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINTN_ERROR, Result);
 
-  Status = SafeUintnMult(Multiplicand, Multiplier, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUintnMult (Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -567,29 +604,32 @@ TestSafeIntnMult_32 (
   )
 {
   EFI_STATUS  Status;
-  INTN Multiplicand = 0x123456;
-  INTN Multiplier = 0x678;
-  INTN Result = 0;
+  INTN        Multiplicand;
+  INTN        Multiplier;
+  INTN        Result;
 
   //
   // If the result of multiplication doesn't overflow MAX_INTN and doesn't
   // underflow MIN_UINTN, it will succeed
   //
-  Status = SafeIntnMult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x75c28c50, Result);
+  Result = 0;
+  Multiplicand = 0x123456;
+  Multiplier = 0x678;
+  Status = SafeIntnMult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x75c28c50, Result);
 
   //
   // Otherwise should result in an error status
   //
   Multiplicand = 0x123456;
   Multiplier = 0xabc;
-  Status = SafeIntnMult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+  Status = SafeIntnMult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INTN_ERROR, Result);
 
-  Status = SafeIntnMult(Multiplicand, Multiplier, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeIntnMult (Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
diff --git a/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests64.c b/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests64.c
index 59eb4f72d6..22bbd476ab 100644
--- a/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests64.c
+++ b/MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests64.c
@@ -36,26 +36,28 @@ TestSafeInt32ToUintn_64 (
   )
 {
   EFI_STATUS  Status;
-  INT32 Operand = 0x5bababab;
-  UINTN Result = 0;
+  INT32       Operand;
+  UINTN       Result;
 
   //
   // If Operand is non-negative, then it's a cast
   //
-  Status = SafeInt32ToUintn(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5bababab, Result);
+  Result = 0;
+  Operand = 0x5bababab;
+  Status = SafeInt32ToUintn (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5bababab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (-1537977259);
-  Status = SafeInt32ToUintn(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+  Status = SafeInt32ToUintn (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINTN_ERROR, Result);
 
-  Status = SafeInt32ToUintn(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt32ToUintn (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -68,8 +70,8 @@ TestSafeUint32ToIntn_64 (
   )
 {
   EFI_STATUS  Status;
-  UINT32 Operand = 0xabababab;
-  INTN Result = 0;
+  UINT32      Operand;
+  INTN        Result;
 
   //
   // For x64, INTN is same as INT64 which is a superset of INT32
@@ -79,9 +81,11 @@ TestSafeUint32ToIntn_64 (
   //
   // If Operand is non-negative, then it's a cast
   //
-  Status = SafeUint32ToIntn(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xabababab, Result);
+  Result = 0;
+  Operand = 0xabababab;
+  Status = SafeUint32ToIntn (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xabababab, Result);
 
   return UNIT_TEST_PASSED;
 }
@@ -94,36 +98,38 @@ TestSafeIntnToInt32_64 (
   )
 {
   EFI_STATUS  Status;
-  INTN Operand = 0x5bababab;
-  INT32 Result = 0;
+  INTN        Operand;
+  INT32       Result;
 
   //
   // If Operand is between MIN_INT32 and  MAX_INT32 inclusive, then it's a cast
   //
-  Status = SafeIntnToInt32(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5bababab, Result);
+  Result = 0;
+  Operand = 0x5bababab;
+  Status = SafeIntnToInt32 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5bababab, Result);
 
   Operand = (-1537977259);
-  Status = SafeIntnToInt32(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL((-1537977259), Result);
+  Status = SafeIntnToInt32 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL ((-1537977259), Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0x5babababefefefef);
-  Status = SafeIntnToInt32(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+  Status = SafeIntnToInt32 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT32_ERROR, Result);
 
   Operand =  (-6605562033422200815);
-  Status = SafeIntnToInt32(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT32_ERROR, Result);
+  Status = SafeIntnToInt32 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT32_ERROR, Result);
 
-  Status = SafeIntnToInt32(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeIntnToInt32 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -136,31 +142,33 @@ TestSafeIntnToUint32_64 (
   )
 {
   EFI_STATUS  Status;
-  INTN Operand = 0xabababab;
-  UINT32 Result = 0;
+  INTN        Operand;
+  UINT32      Result;
 
   //
   // If Operand is between 0 and  MAX_UINT32 inclusive, then it's a cast
   //
-  Status = SafeIntnToUint32(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xabababab, Result);
+  Result = 0;
+  Operand = 0xabababab;
+  Status = SafeIntnToUint32 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xabababab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0x5babababefefefef);
-  Status = SafeIntnToUint32(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+  Status = SafeIntnToUint32 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT32_ERROR, Result);
 
   Operand =  (-6605562033422200815);
-  Status = SafeIntnToUint32(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+  Status = SafeIntnToUint32 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT32_ERROR, Result);
 
-  Status = SafeIntnToUint32(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeIntnToUint32 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -173,26 +181,28 @@ TestSafeUintnToUint32_64 (
   )
 {
   EFI_STATUS  Status;
-  UINTN Operand = 0xabababab;
-  UINT32 Result = 0;
+  UINTN       Operand;
+  UINT32      Result;
 
   //
   // If Operand is <= MAX_UINT32, then it's a cast
   //
-  Status = SafeUintnToUint32(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xabababab, Result);
+  Result = 0;
+  Operand = 0xabababab;
+  Status = SafeUintnToUint32 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xabababab, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xababababefefefef);
-  Status = SafeUintnToUint32(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINT32_ERROR, Result);
+  Status = SafeUintnToUint32 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINT32_ERROR, Result);
 
-  Status = SafeUintnToUint32(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUintnToUint32 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -205,26 +215,28 @@ TestSafeUintnToIntn_64 (
   )
 {
   EFI_STATUS  Status;
-  UINTN Operand = 0x5babababefefefef;
-  INTN Result = 0;
+  UINTN       Operand;
+  INTN        Result;
 
   //
   // If Operand is <= MAX_INTN (0x7fff_ffff_ffff_ffff), then it's a cast
   //
-  Status = SafeUintnToIntn(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5babababefefefef, Result);
+  Result = 0;
+  Operand = 0x5babababefefefef;
+  Status = SafeUintnToIntn (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5babababefefefef, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xababababefefefef);
-  Status = SafeUintnToIntn(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+  Status = SafeUintnToIntn (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INTN_ERROR, Result);
 
-  Status = SafeUintnToIntn(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUintnToIntn (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -237,26 +249,28 @@ TestSafeUintnToInt64_64 (
   )
 {
   EFI_STATUS  Status;
-  UINTN Operand = 0x5babababefefefef;
-  INT64 Result = 0;
+  UINTN       Operand;
+  INT64       Result;
 
   //
   // If Operand is <= MAX_INT64, then it's a cast
   //
-  Status = SafeUintnToInt64(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5babababefefefef, Result);
+  Result = 0;
+  Operand = 0x5babababefefefef;
+  Status = SafeUintnToInt64 (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5babababefefefef, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xababababefefefef);
-  Status = SafeUintnToInt64(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INT64_ERROR, Result);
+  Status = SafeUintnToInt64 (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INT64_ERROR, Result);
 
-  Status = SafeUintnToInt64(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUintnToInt64 (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -269,15 +283,17 @@ TestSafeInt64ToIntn_64 (
   )
 {
   EFI_STATUS  Status;
-  INT64 Operand = 0x5babababefefefef;
-  INTN Result = 0;
+  INT64       Operand;
+  INTN        Result;
 
   //
   // INTN is same as INT64 in x64, so this is just a cast
   //
-  Status = SafeInt64ToIntn(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5babababefefefef, Result);
+  Result = 0;
+  Operand = 0x5babababefefefef;
+  Status = SafeInt64ToIntn (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5babababefefefef, Result);
 
   return UNIT_TEST_PASSED;
 }
@@ -290,26 +306,28 @@ TestSafeInt64ToUintn_64 (
   )
 {
   EFI_STATUS  Status;
-  INT64 Operand = 0x5babababefefefef;
-  UINTN Result = 0;
+  INT64       Operand;
+  UINTN       Result;
 
   //
   // If Operand is non-negative, then it's a cast
   //
-  Status = SafeInt64ToUintn(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5babababefefefef, Result);
+  Result = 0;
+  Operand = 0x5babababefefefef;
+  Status = SafeInt64ToUintn (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5babababefefefef, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand =  (-6605562033422200815);
-  Status = SafeInt64ToUintn(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+  Status = SafeInt64ToUintn (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINTN_ERROR, Result);
 
-  Status = SafeInt64ToUintn(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeInt64ToUintn (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -322,26 +340,28 @@ TestSafeUint64ToIntn_64 (
   )
 {
   EFI_STATUS  Status;
-  UINT64 Operand = 0x5babababefefefef;
-  INTN Result = 0;
+  UINT64      Operand;
+  INTN        Result;
 
   //
   // If Operand is <= MAX_INTN (0x7fff_ffff_ffff_ffff), then it's a cast
   //
-  Status = SafeUint64ToIntn(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x5babababefefefef, Result);
+  Result = 0;
+  Operand = 0x5babababefefefef;
+  Status = SafeUint64ToIntn (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x5babababefefefef, Result);
 
   //
   // Otherwise should result in an error status
   //
   Operand = (0xababababefefefef);
-  Status = SafeUint64ToIntn(Operand, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+  Status = SafeUint64ToIntn (Operand, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INTN_ERROR, Result);
 
-  Status = SafeUint64ToIntn(Operand, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUint64ToIntn (Operand, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -354,15 +374,17 @@ TestSafeUint64ToUintn_64 (
   )
 {
   EFI_STATUS  Status;
-  UINT64 Operand = 0xababababefefefef;
-  UINTN Result = 0;
+  UINT64      Operand;
+  UINTN       Result;
 
   //
   // UINTN is same as UINT64 in x64, so this is just a cast
   //
-  Status = SafeUint64ToUintn(Operand, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0xababababefefefef, Result);
+  Result = 0;
+  Operand = 0xababababefefefef;
+  Status = SafeUint64ToUintn (Operand, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0xababababefefefef, Result);
 
   return UNIT_TEST_PASSED;
 }
@@ -375,28 +397,31 @@ TestSafeUintnAdd_64 (
   )
 {
   EFI_STATUS  Status;
-  UINTN Augend = 0x3a3a3a3a12121212;
-  UINTN Addend = 0x3a3a3a3a12121212;
-  UINTN Result = 0;
+  UINTN       Augend;
+  UINTN       Addend;
+  UINTN       Result;
 
   //
   // If the result of addition doesn't overflow MAX_UINTN, then it's addition
   //
-  Status = SafeUintnAdd(Augend, Addend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x7474747424242424, Result);
+  Result = 0;
+  Augend = 0x3a3a3a3a12121212;
+  Addend = 0x3a3a3a3a12121212;
+  Status = SafeUintnAdd (Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x7474747424242424, Result);
 
   //
   // Otherwise should result in an error status
   //
   Augend = 0xababababefefefef;
   Addend = 0xbcbcbcbcdededede;
-  Status = SafeUintnAdd(Augend, Addend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+  Status = SafeUintnAdd (Augend, Addend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINTN_ERROR, Result);
 
-  Status = SafeUintnAdd(Augend, Addend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUintnAdd (Augend, Addend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -409,41 +434,44 @@ TestSafeIntnAdd_64 (
   )
 {
   EFI_STATUS  Status;
-  INTN Augend = 0x3a3a3a3a3a3a3a3a;
-  INTN Addend = 0x3a3a3a3a3a3a3a3a;
-  INTN Result = 0;
+  INTN        Augend;
+  INTN        Addend;
+  INTN        Result;
 
   //
   // If the result of addition doesn't overflow MAX_INTN
   // and doesn't underflow MIN_INTN, then it's addition
   //
-  Status = SafeIntnAdd(Augend, Addend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x7474747474747474, Result);
+  Result = 0;
+  Augend = 0x3a3a3a3a3a3a3a3a;
+  Addend = 0x3a3a3a3a3a3a3a3a;
+  Status = SafeIntnAdd (Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x7474747474747474, Result);
 
   Augend = (-4195730024608447034);
   Addend = (-4195730024608447034);
-  Status = SafeIntnAdd(Augend, Addend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL((-8391460049216894068), Result);
+  Status = SafeIntnAdd (Augend, Addend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL ((-8391460049216894068), Result);
 
   //
   // Otherwise should result in an error status
   //
   Augend = 0x5a5a5a5a5a5a5a5a;
   Addend = 0x5a5a5a5a5a5a5a5a;
-  Status = SafeIntnAdd(Augend, Addend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+  Status = SafeIntnAdd (Augend, Addend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INTN_ERROR, Result);
 
   Augend = (-6510615555426900570);
   Addend = (-6510615555426900570);
-  Status = SafeIntnAdd(Augend, Addend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+  Status = SafeIntnAdd (Augend, Addend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INTN_ERROR, Result);
 
-  Status = SafeIntnAdd(Augend, Addend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeIntnAdd (Augend, Addend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -456,28 +484,31 @@ TestSafeUintnSub_64 (
   )
 {
   EFI_STATUS  Status;
-  UINTN Minuend = 0x5a5a5a5a5a5a5a5a;
-  UINTN Subtrahend = 0x3b3b3b3b3b3b3b3b;
-  UINTN Result = 0;
+  UINTN       Minuend;
+  UINTN       Subtrahend;
+  UINTN       Result;
 
   //
   // If Minuend >= Subtrahend, then it's subtraction
   //
-  Status = SafeUintnSub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x1f1f1f1f1f1f1f1f, Result);
+  Result = 0;
+  Minuend = 0x5a5a5a5a5a5a5a5a;
+  Subtrahend = 0x3b3b3b3b3b3b3b3b;
+  Status = SafeUintnSub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x1f1f1f1f1f1f1f1f, Result);
 
   //
   // Otherwise should result in an error status
   //
   Minuend = 0x5a5a5a5a5a5a5a5a;
   Subtrahend = 0x6d6d6d6d6d6d6d6d;
-  Status = SafeUintnSub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+  Status = SafeUintnSub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINTN_ERROR, Result);
 
-  Status = SafeUintnSub(Minuend, Subtrahend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUintnSub (Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -490,41 +521,44 @@ TestSafeIntnSub_64 (
   )
 {
   EFI_STATUS  Status;
-  INTN Minuend = 0x5a5a5a5a5a5a5a5a;
-  INTN Subtrahend = 0x3a3a3a3a3a3a3a3a;
-  INTN Result = 0;
+  INTN        Minuend;
+  INTN        Subtrahend;
+  INTN        Result;
 
   //
   // If the result of subtractions doesn't overflow MAX_INTN or
   // underflow MIN_INTN, then it's subtraction
   //
-  Status = SafeIntnSub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x2020202020202020, Result);
+  Minuend = 0x5a5a5a5a5a5a5a5a;
+  Subtrahend = 0x3a3a3a3a3a3a3a3a;
+  Result = 0;
+  Status = SafeIntnSub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x2020202020202020, Result);
 
   Minuend = 0x3a3a3a3a3a3a3a3a;
   Subtrahend = 0x5a5a5a5a5a5a5a5a;
-  Status = SafeIntnSub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL((-2314885530818453536), Result);
+  Status = SafeIntnSub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL ((-2314885530818453536), Result);
 
   //
   // Otherwise should result in an error status
   //
   Minuend = (-8825501086245354106);
   Subtrahend = 8825501086245354106;
-  Status = SafeIntnSub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+  Status = SafeIntnSub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INTN_ERROR, Result);
 
   Minuend = (8825501086245354106);
   Subtrahend = (-8825501086245354106);
-  Status = SafeIntnSub(Minuend, Subtrahend, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+  Status = SafeIntnSub (Minuend, Subtrahend, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INTN_ERROR, Result);
 
-  Status = SafeIntnSub(Minuend, Subtrahend, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeIntnSub (Minuend, Subtrahend, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -537,28 +571,31 @@ TestSafeUintnMult_64 (
   )
 {
   EFI_STATUS  Status;
-  UINTN Multiplicand = 0x123456789a;
-  UINTN Multiplier = 0x1234567;
-  UINTN Result = 0;
+  UINTN       Multiplicand;
+  UINTN       Multiplier;
+  UINTN       Result;
 
   //
   // If the result of multiplication doesn't overflow MAX_UINTN, it will succeed
   //
-  Status = SafeUintnMult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x14b66db9745a07f6, Result);
+  Result = 0;
+  Multiplicand = 0x123456789a;
+  Multiplier = 0x1234567;
+  Status = SafeUintnMult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x14b66db9745a07f6, Result);
 
   //
   // Otherwise should result in an error status
   //
   Multiplicand = 0x123456789a;
   Multiplier = 0x12345678;
-  Status = SafeUintnMult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(UINTN_ERROR, Result);
+  Status = SafeUintnMult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (UINTN_ERROR, Result);
 
-  Status = SafeUintnMult(Multiplicand, Multiplier, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeUintnMult (Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
@@ -571,29 +608,32 @@ TestSafeIntnMult_64 (
   )
 {
   EFI_STATUS  Status;
-  INTN Multiplicand = 0x123456789;
-  INTN Multiplier = 0x6789abcd;
-  INTN Result = 0;
+  INTN        Multiplicand;
+  INTN        Multiplier;
+  INTN        Result;
 
   //
   // If the result of multiplication doesn't overflow MAX_INTN and doesn't
   // underflow MIN_UINTN, it will succeed
   //
-  Status = SafeIntnMult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_NOT_EFI_ERROR(Status);
-  UT_ASSERT_EQUAL(0x75cd9045220d6bb5, Result);
+  Result = 0;
+  Multiplicand = 0x123456789;
+  Multiplier = 0x6789abcd;
+  Status = SafeIntnMult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_NOT_EFI_ERROR (Status);
+  UT_ASSERT_EQUAL (0x75cd9045220d6bb5, Result);
 
   //
   // Otherwise should result in an error status
   //
   Multiplicand = 0x123456789;
   Multiplier = 0xa789abcd;
-  Status = SafeIntnMult(Multiplicand, Multiplier, &Result);
-  UT_ASSERT_EQUAL(RETURN_BUFFER_TOO_SMALL, Status);
-  UT_ASSERT_EQUAL(INTN_ERROR, Result);
+  Status = SafeIntnMult (Multiplicand, Multiplier, &Result);
+  UT_ASSERT_EQUAL (RETURN_BUFFER_TOO_SMALL, Status);
+  UT_ASSERT_EQUAL (INTN_ERROR, Result);
 
-  Status = SafeIntnMult(Multiplicand, Multiplier, NULL);
-  UT_ASSERT_EQUAL(RETURN_INVALID_PARAMETER, Status);
+  Status = SafeIntnMult (Multiplicand, Multiplier, NULL);
+  UT_ASSERT_EQUAL (RETURN_INVALID_PARAMETER, Status);
 
   return UNIT_TEST_PASSED;
 }
-- 
2.14.2.windows.3



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [staging/edk2-test Patch 0/2] MdePkgUnitTest: Add unit test package for MdePkg
  2017-12-20  0:16 [staging/edk2-test Patch 0/2] MdePkgUnitTest: Add unit test package for MdePkg Kinney, Michael D
  2017-12-20  0:16 ` [staging/edk2-test Patch 1/2] " Kinney, Michael D
  2017-12-20  0:16 ` [staging/edk2-test Patch 2/2] MdePkgUnitTest: Fix EDK II style issues Kinney, Michael D
@ 2018-01-18  8:09 ` Sean Brogan
  2 siblings, 0 replies; 4+ messages in thread
From: Sean Brogan @ 2018-01-18  8:09 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel@lists.01.org; +Cc: Gao, Liming

Reviewed-by: Sean Brogan <sean.brogan@microsoft.com>

-----Original Message-----
From: Kinney, Michael D [mailto:michael.d.kinney@intel.com] 
Sent: Tuesday, December 19, 2017 4:16 PM
To: edk2-devel@lists.01.org
Cc: Sean Brogan <sean.brogan@microsoft.com>; Gao, Liming <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: [staging/edk2-test Patch 0/2] MdePkgUnitTest: Add unit test package for MdePkg

Initial version of a unit test package for the MdePkg that uses services from the MsUnitTestPkg to implement test cases for the SafeIntLib in the MdePkg.

The initial version of these tests is from the following branch and commit:

https://github.com/Microsoft/MS_UEFI/tree/share/intsafelib/MdeModulePkg/UnitTests/IntSafeLib
https://github.com/Microsoft/MS_UEFI/commit/cc2e9d229d4e876ab64d75dee16761a297582fd9

Additional updates for CPU compatibility, CHAR8 signed/unsigned, and EDK II code style issues.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>

Kinney, Michael D (1):
  MdePkgUnitTest: Fix EDK II style issues

Michael D Kinney (1):
  MdePkgUnitTest: Add unit test package for MdePkg

 MdePkgUnitTest/MdePkgUnitTest.dec                  |   20 +
 MdePkgUnitTest/MdePkgUnitTest.dsc                  |   57 +
 .../SafeIntLib/SafeIntLibUintnIntnUnitTests32.c    |   54 +
 .../SafeIntLib/SafeIntLibUintnIntnUnitTests64.c    |   54 +
 .../SafeIntLib/SafeIntLibUintnIntnUnitTestsEbc.c   |   65 +
 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.c    | 3667 ++++++++++++++++++++
 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.h    |  155 +
 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.inf  |   69 +
 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests32.c  |  635 ++++  MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests64.c  |  639 ++++
 10 files changed, 5415 insertions(+)
 create mode 100644 MdePkgUnitTest/MdePkgUnitTest.dec  create mode 100644 MdePkgUnitTest/MdePkgUnitTest.dsc  create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTests32.c
 create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTests64.c
 create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUintnIntnUnitTestsEbc.c
 create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.c
 create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.h
 create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests.inf
 create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests32.c
 create mode 100644 MdePkgUnitTest/SafeIntLib/SafeIntLibUnitTests64.c

--
2.14.2.windows.3



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-18  8:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-20  0:16 [staging/edk2-test Patch 0/2] MdePkgUnitTest: Add unit test package for MdePkg Kinney, Michael D
2017-12-20  0:16 ` [staging/edk2-test Patch 1/2] " Kinney, Michael D
2017-12-20  0:16 ` [staging/edk2-test Patch 2/2] MdePkgUnitTest: Fix EDK II style issues Kinney, Michael D
2018-01-18  8:09 ` [staging/edk2-test Patch 0/2] MdePkgUnitTest: Add unit test package for MdePkg Sean Brogan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox