/* If Buffer is NULL, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */
UINT32 EFIAPI CalculateCrc32(IN VOID *Buffer, IN UINTN Length)
/* If Buffer is NULL, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */
UINT32 EFIAPI CalculateCrc32(IN VOID *Buffer, IN UINTN Length)
{
  UINTN   Index;
  UINT32  Crc;
  UINT8   *Ptr;
  ASSERT (Buffer != NULL);
  ASSERT (Length <= (MAX_ADDRESS - ((UINTN)Buffer) + 1));
  Crc = 0xffffffff;
  for (Index = 0, Ptr = Buffer; Index < Length; Index++, Ptr++) {
    Crc = (Crc >> 8) ^ mCrcTable[(UINT8)Crc ^ *Ptr];
  }
  return Crc ^ 0xffffffff;
}