/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeIntnToUint32(IN INTN Operand, OUT UINT32 *Result)
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeIntnToUint32(IN INTN Operand, OUT UINT32 *Result)
{
  RETURN_STATUS  Status;
  if (Result == NULL) {
    return RETURN_INVALID_PARAMETER;
  }
  if (sizeof (UINTN) == sizeof (UINT32)) {
    if (Operand >= 0) {
      *Result = (UINT32)Operand;
      Status  = RETURN_SUCCESS;
    } else {
      *Result = UINT32_ERROR;
      Status  = RETURN_BUFFER_TOO_SMALL;
    }
    return Status;
  }
  return SafeInt64ToUint32 ((INT64)Operand, Result);
}