/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeInt64ToUint8(IN INT64 Operand, OUT UINT8 *Result)
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeInt64ToUint8(IN INT64 Operand, OUT UINT8 *Result)
{
  RETURN_STATUS  Status;
  if (Result == NULL) {
    return RETURN_INVALID_PARAMETER;
  }
  if ((Operand >= 0) && (Operand <= MAX_UINT8)) {
    *Result = (UINT8)Operand;
    Status  = RETURN_SUCCESS;
  } else {
    *Result = UINT8_ERROR;
    Status  = RETURN_BUFFER_TOO_SMALL;
  }
  return Status;
}