/* If the requested operation results in an overflow or an underflow condition, then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeChar8Sub(IN CHAR8 Minuend, IN CHAR8 Subtrahend, OUT CHAR8 *Result)
/* If the requested operation results in an overflow or an underflow condition, then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeChar8Sub(IN CHAR8 Minuend, IN CHAR8 Subtrahend, OUT CHAR8 *Result)
{
  INT32  Minuend32;
  INT32  Subtrahend32;
  if (Result == NULL) {
    return RETURN_INVALID_PARAMETER;
  }
  Minuend32    = (INT32)Minuend;
  Subtrahend32 = (INT32)Subtrahend;
  if ((Minuend32 < 0) || (Minuend32 > MAX_INT8)) {
    *Result = CHAR8_ERROR;
    return RETURN_BUFFER_TOO_SMALL;
  }
  if ((Subtrahend32 < 0) || (Subtrahend32 > MAX_INT8)) {
    *Result = CHAR8_ERROR;
    return RETURN_BUFFER_TOO_SMALL;
  }
  return SafeInt32ToChar8 (Minuend32 - Subtrahend32, Result);
}