XenevaOS
Loading...
Searching...
No Matches
Macros | Functions
SafeIntLib.h File Reference

Go to the source code of this file.

Macros

#define INT8_ERROR   ((INT8) -1)
 
#define UINT8_ERROR   MAX_UINT8
 
#define CHAR8_ERROR   ((CHAR8)(MAX_INT8))
 
#define INT16_ERROR   ((INT16) -1)
 
#define UINT16_ERROR   MAX_UINT16
 
#define CHAR16_ERROR   MAX_UINT16
 
#define INT32_ERROR   ((INT32) -1)
 
#define UINT32_ERROR   MAX_UINT32
 
#define INT64_ERROR   ((INT64) -1)
 
#define UINT64_ERROR   MAX_UINT64
 
#define INTN_ERROR   ((INTN) -1)
 
#define UINTN_ERROR   MAX_UINTN
 
#define SafeInt8ToChar16   SafeInt8ToUint16
 
#define SafeInt16ToChar16   SafeInt16ToUint16
 
#define SafeInt32ToChar16   SafeInt32ToUint16
 
#define SafeUint32ToChar16   SafeUint32ToUint16
 
#define SafeInt64ToChar16   SafeInt64ToUint16
 
#define SafeUint64ToChar16   SafeUint64ToUint16
 
#define SafeIntnToChar16   SafeIntnToUint16
 
#define SafeUintnToChar16   SafeUintnToUint16
 
#define SafeChar16ToInt8   SafeUint16ToInt8
 
#define SafeChar16ToUint8   SafeUint16ToUint8
 
#define SafeChar16ToChar8   SafeUint16ToChar8
 
#define SafeChar16ToInt16   SafeUint16ToInt16
 
#define SafeChar16Mult   SafeUint16Mult
 
#define SafeChar16Sub   SafeUint16Sub
 
#define SafeChar16Add   SafeUint16Add
 

Functions

RETURN_STATUS EFIAPI SafeInt8ToUint8 (IN INT8 Operand, OUT UINT8 *Result)
 
RETURN_STATUS EFIAPI SafeInt8ToChar8 (IN INT8 Operand, OUT CHAR8 *Result)
 
RETURN_STATUS EFIAPI SafeInt8ToUint16 (IN INT8 Operand, OUT UINT16 *Result)
 
RETURN_STATUS EFIAPI SafeInt8ToUint32 (IN INT8 Operand, OUT UINT32 *Result)
 
RETURN_STATUS EFIAPI SafeInt8ToUintn (IN INT8 Operand, OUT UINTN *Result)
 
RETURN_STATUS EFIAPI SafeInt8ToUint64 (IN INT8 Operand, OUT UINT64 *Result)
 
RETURN_STATUS EFIAPI SafeUint8ToInt8 (IN UINT8 Operand, OUT INT8 *Result)
 
RETURN_STATUS EFIAPI SafeUint8ToChar8 (IN UINT8 Operand, OUT CHAR8 *Result)
 
RETURN_STATUS EFIAPI SafeInt16ToInt8 (IN INT16 Operand, OUT INT8 *Result)
 
RETURN_STATUS EFIAPI SafeInt16ToChar8 (IN INT16 Operand, OUT CHAR8 *Result)
 
RETURN_STATUS EFIAPI SafeInt16ToUint8 (IN INT16 Operand, OUT UINT8 *Result)
 
RETURN_STATUS EFIAPI SafeInt16ToUint16 (IN INT16 Operand, OUT UINT16 *Result)
 
RETURN_STATUS EFIAPI SafeInt16ToUint32 (IN INT16 Operand, OUT UINT32 *Result)
 
RETURN_STATUS EFIAPI SafeInt16ToUintn (IN INT16 Operand, OUT UINTN *Result)
 
RETURN_STATUS EFIAPI SafeInt16ToUint64 (IN INT16 Operand, OUT UINT64 *Result)
 
RETURN_STATUS EFIAPI SafeUint16ToInt8 (IN UINT16 Operand, OUT INT8 *Result)
 
RETURN_STATUS EFIAPI SafeUint16ToChar8 (IN UINT16 Operand, OUT CHAR8 *Result)
 
RETURN_STATUS EFIAPI SafeUint16ToUint8 (IN UINT16 Operand, OUT UINT8 *Result)
 
RETURN_STATUS EFIAPI SafeUint16ToInt16 (IN UINT16 Operand, OUT INT16 *Result)
 
RETURN_STATUS EFIAPI SafeInt32ToInt8 (IN INT32 Operand, OUT INT8 *Result)
 
RETURN_STATUS EFIAPI SafeInt32ToChar8 (IN INT32 Operand, OUT CHAR8 *Result)
 
RETURN_STATUS EFIAPI SafeInt32ToUint8 (IN INT32 Operand, OUT UINT8 *Result)
 
RETURN_STATUS EFIAPI SafeInt32ToInt16 (IN INT32 Operand, OUT INT16 *Result)
 
RETURN_STATUS EFIAPI SafeInt32ToUint16 (IN INT32 Operand, OUT UINT16 *Result)
 
RETURN_STATUS EFIAPI SafeInt32ToUint32 (IN INT32 Operand, OUT UINT32 *Result)
 
RETURN_STATUS EFIAPI SafeInt32ToUintn (IN INT32 Operand, OUT UINTN *Result)
 
RETURN_STATUS EFIAPI SafeInt32ToUint64 (IN INT32 Operand, OUT UINT64 *Result)
 
RETURN_STATUS EFIAPI SafeUint32ToInt8 (IN UINT32 Operand, OUT INT8 *Result)
 
RETURN_STATUS EFIAPI SafeUint32ToChar8 (IN UINT32 Operand, OUT CHAR8 *Result)
 
RETURN_STATUS EFIAPI SafeUint32ToUint8 (IN UINT32 Operand, OUT UINT8 *Result)
 
RETURN_STATUS EFIAPI SafeUint32ToInt16 (IN UINT32 Operand, OUT INT16 *Result)
 
RETURN_STATUS EFIAPI SafeUint32ToUint16 (IN UINT32 Operand, OUT UINT16 *Result)
 
RETURN_STATUS EFIAPI SafeUint32ToInt32 (IN UINT32 Operand, OUT INT32 *Result)
 
RETURN_STATUS EFIAPI SafeUint32ToIntn (IN UINT32 Operand, OUT INTN *Result)
 
RETURN_STATUS EFIAPI SafeIntnToInt8 (IN INTN Operand, OUT INT8 *Result)
 
RETURN_STATUS EFIAPI SafeIntnToChar8 (IN INTN Operand, OUT CHAR8 *Result)
 
RETURN_STATUS EFIAPI SafeIntnToUint8 (IN INTN Operand, OUT UINT8 *Result)
 
RETURN_STATUS EFIAPI SafeIntnToInt16 (IN INTN Operand, OUT INT16 *Result)
 
RETURN_STATUS EFIAPI SafeIntnToUint16 (IN INTN Operand, OUT UINT16 *Result)
 
RETURN_STATUS EFIAPI SafeIntnToInt32 (IN INTN Operand, OUT INT32 *Result)
 
RETURN_STATUS EFIAPI SafeIntnToUint32 (IN INTN Operand, OUT UINT32 *Result)
 
RETURN_STATUS EFIAPI SafeIntnToUintn (IN INTN Operand, OUT UINTN *Result)
 
RETURN_STATUS EFIAPI SafeIntnToUint64 (IN INTN Operand, OUT UINT64 *Result)
 
RETURN_STATUS EFIAPI SafeUintnToInt8 (IN UINTN Operand, OUT INT8 *Result)
 
RETURN_STATUS EFIAPI SafeUintnToChar8 (IN UINTN Operand, OUT CHAR8 *Result)
 
RETURN_STATUS EFIAPI SafeUintnToUint8 (IN UINTN Operand, OUT UINT8 *Result)
 
RETURN_STATUS EFIAPI SafeUintnToInt16 (IN UINTN Operand, OUT INT16 *Result)
 
RETURN_STATUS EFIAPI SafeUintnToUint16 (IN UINTN Operand, OUT UINT16 *Result)
 
RETURN_STATUS EFIAPI SafeUintnToInt32 (IN UINTN Operand, OUT INT32 *Result)
 
RETURN_STATUS EFIAPI SafeUintnToUint32 (IN UINTN Operand, OUT UINT32 *Result)
 
RETURN_STATUS EFIAPI SafeUintnToIntn (IN UINTN Operand, OUT INTN *Result)
 
RETURN_STATUS EFIAPI SafeUintnToInt64 (IN UINTN Operand, OUT INT64 *Result)
 
RETURN_STATUS EFIAPI SafeInt64ToInt8 (IN INT64 Operand, OUT INT8 *Result)
 
RETURN_STATUS EFIAPI SafeInt64ToChar8 (IN INT64 Operand, OUT CHAR8 *Result)
 
RETURN_STATUS EFIAPI SafeInt64ToUint8 (IN INT64 Operand, OUT UINT8 *Result)
 
RETURN_STATUS EFIAPI SafeInt64ToInt16 (IN INT64 Operand, OUT INT16 *Result)
 
RETURN_STATUS EFIAPI SafeInt64ToUint16 (IN INT64 Operand, OUT UINT16 *Result)
 
RETURN_STATUS EFIAPI SafeInt64ToInt32 (IN INT64 Operand, OUT INT32 *Result)
 
RETURN_STATUS EFIAPI SafeInt64ToUint32 (IN INT64 Operand, OUT UINT32 *Result)
 
RETURN_STATUS EFIAPI SafeInt64ToIntn (IN INT64 Operand, OUT INTN *Result)
 
RETURN_STATUS EFIAPI SafeInt64ToUintn (IN INT64 Operand, OUT UINTN *Result)
 
RETURN_STATUS EFIAPI SafeInt64ToUint64 (IN INT64 Operand, OUT UINT64 *Result)
 
RETURN_STATUS EFIAPI SafeUint64ToInt8 (IN UINT64 Operand, OUT INT8 *Result)
 
RETURN_STATUS EFIAPI SafeUint64ToChar8 (IN UINT64 Operand, OUT CHAR8 *Result)
 
RETURN_STATUS EFIAPI SafeUint64ToUint8 (IN UINT64 Operand, OUT UINT8 *Result)
 
RETURN_STATUS EFIAPI SafeUint64ToInt16 (IN UINT64 Operand, OUT INT16 *Result)
 
RETURN_STATUS EFIAPI SafeUint64ToUint16 (IN UINT64 Operand, OUT UINT16 *Result)
 
RETURN_STATUS EFIAPI SafeUint64ToInt32 (IN UINT64 Operand, OUT INT32 *Result)
 
RETURN_STATUS EFIAPI SafeUint64ToUint32 (IN UINT64 Operand, OUT UINT32 *Result)
 
RETURN_STATUS EFIAPI SafeUint64ToIntn (IN UINT64 Operand, OUT INTN *Result)
 
RETURN_STATUS EFIAPI SafeUint64ToUintn (IN UINT64 Operand, OUT UINTN *Result)
 
RETURN_STATUS EFIAPI SafeUint64ToInt64 (IN UINT64 Operand, OUT INT64 *Result)
 
RETURN_STATUS EFIAPI SafeUint8Add (IN UINT8 Augend, IN UINT8 Addend, OUT UINT8 *Result)
 
RETURN_STATUS EFIAPI SafeUint16Add (IN UINT16 Augend, IN UINT16 Addend, OUT UINT16 *Result)
 
RETURN_STATUS EFIAPI SafeUint32Add (IN UINT32 Augend, IN UINT32 Addend, OUT UINT32 *Result)
 
RETURN_STATUS EFIAPI SafeUintnAdd (IN UINTN Augend, IN UINTN Addend, OUT UINTN *Result)
 
RETURN_STATUS EFIAPI SafeUint64Add (IN UINT64 Augend, IN UINT64 Addend, OUT UINT64 *Result)
 
RETURN_STATUS EFIAPI SafeUint8Sub (IN UINT8 Minuend, IN UINT8 Subtrahend, OUT UINT8 *Result)
 
RETURN_STATUS EFIAPI SafeUint16Sub (IN UINT16 Minuend, IN UINT16 Subtrahend, OUT UINT16 *Result)
 
RETURN_STATUS EFIAPI SafeUint32Sub (IN UINT32 Minuend, IN UINT32 Subtrahend, OUT UINT32 *Result)
 
RETURN_STATUS EFIAPI SafeUintnSub (IN UINTN Minuend, IN UINTN Subtrahend, OUT UINTN *Result)
 
RETURN_STATUS EFIAPI SafeUint64Sub (IN UINT64 Minuend, IN UINT64 Subtrahend, OUT UINT64 *Result)
 
RETURN_STATUS EFIAPI SafeUint8Mult (IN UINT8 Multiplicand, IN UINT8 Multiplier, OUT UINT8 *Result)
 
RETURN_STATUS EFIAPI SafeUint16Mult (IN UINT16 Multiplicand, IN UINT16 Multiplier, OUT UINT16 *Result)
 
RETURN_STATUS EFIAPI SafeUint32Mult (IN UINT32 Multiplicand, IN UINT32 Multiplier, OUT UINT32 *Result)
 
RETURN_STATUS EFIAPI SafeUintnMult (IN UINTN Multiplicand, IN UINTN Multiplier, OUT UINTN *Result)
 
RETURN_STATUS EFIAPI SafeUint64Mult (IN UINT64 Multiplicand, IN UINT64 Multiplier, OUT UINT64 *Result)
 
RETURN_STATUS EFIAPI SafeInt8Add (IN INT8 Augend, IN INT8 Addend, OUT INT8 *Result)
 
RETURN_STATUS EFIAPI SafeChar8Add (IN CHAR8 Augend, IN CHAR8 Addend, OUT CHAR8 *Result)
 
RETURN_STATUS EFIAPI SafeInt16Add (IN INT16 Augend, IN INT16 Addend, OUT INT16 *Result)
 
RETURN_STATUS EFIAPI SafeInt32Add (IN INT32 Augend, IN INT32 Addend, OUT INT32 *Result)
 
RETURN_STATUS EFIAPI SafeIntnAdd (IN INTN Augend, IN INTN Addend, OUT INTN *Result)
 
RETURN_STATUS EFIAPI SafeInt64Add (IN INT64 Augend, IN INT64 Addend, OUT INT64 *Result)
 
RETURN_STATUS EFIAPI SafeInt8Sub (IN INT8 Minuend, IN INT8 Subtrahend, OUT INT8 *Result)
 
RETURN_STATUS EFIAPI SafeChar8Sub (IN CHAR8 Minuend, IN CHAR8 Subtrahend, OUT CHAR8 *Result)
 
RETURN_STATUS EFIAPI SafeInt16Sub (IN INT16 Minuend, IN INT16 Subtrahend, OUT INT16 *Result)
 
RETURN_STATUS EFIAPI SafeInt32Sub (IN INT32 Minuend, IN INT32 Subtrahend, OUT INT32 *Result)
 
RETURN_STATUS EFIAPI SafeIntnSub (IN INTN Minuend, IN INTN Subtrahend, OUT INTN *Result)
 
RETURN_STATUS EFIAPI SafeInt64Sub (IN INT64 Minuend, IN INT64 Subtrahend, OUT INT64 *Result)
 
RETURN_STATUS EFIAPI SafeInt8Mult (IN INT8 Multiplicand, IN INT8 Multiplier, OUT INT8 *Result)
 
RETURN_STATUS EFIAPI SafeChar8Mult (IN CHAR8 Multiplicand, IN CHAR8 Multiplier, OUT CHAR8 *Result)
 
RETURN_STATUS EFIAPI SafeInt16Mult (IN INT16 Multiplicand, IN INT16 Multiplier, OUT INT16 *Result)
 
RETURN_STATUS EFIAPI SafeInt32Mult (IN INT32 Multiplicand, IN INT32 Multiplier, OUT INT32 *Result)
 
RETURN_STATUS EFIAPI SafeIntnMult (IN INTN Multiplicand, IN INTN Multiplier, OUT INTN *Result)
 
RETURN_STATUS EFIAPI SafeInt64Mult (IN INT64 Multiplicand, IN INT64 Multiplier, OUT INT64 *Result)
 

Detailed Description

This library provides helper functions to prevent integer overflow during type conversion, addition, subtraction, and multiplication.

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.

Macro Definition Documentation

◆ CHAR16_ERROR

#define CHAR16_ERROR   MAX_UINT16

◆ CHAR8_ERROR

#define CHAR8_ERROR   ((CHAR8)(MAX_INT8))

◆ INT16_ERROR

#define INT16_ERROR   ((INT16) -1)

◆ INT32_ERROR

#define INT32_ERROR   ((INT32) -1)

◆ INT64_ERROR

#define INT64_ERROR   ((INT64) -1)

◆ INT8_ERROR

#define INT8_ERROR   ((INT8) -1)

◆ INTN_ERROR

#define INTN_ERROR   ((INTN) -1)

◆ SafeChar16Add

#define SafeChar16Add   SafeUint16Add

◆ SafeChar16Mult

#define SafeChar16Mult   SafeUint16Mult

◆ SafeChar16Sub

#define SafeChar16Sub   SafeUint16Sub

◆ SafeChar16ToChar8

#define SafeChar16ToChar8   SafeUint16ToChar8

◆ SafeChar16ToInt16

#define SafeChar16ToInt16   SafeUint16ToInt16

◆ SafeChar16ToInt8

#define SafeChar16ToInt8   SafeUint16ToInt8

◆ SafeChar16ToUint8

#define SafeChar16ToUint8   SafeUint16ToUint8

◆ SafeInt16ToChar16

#define SafeInt16ToChar16   SafeInt16ToUint16

◆ SafeInt32ToChar16

#define SafeInt32ToChar16   SafeInt32ToUint16

◆ SafeInt64ToChar16

#define SafeInt64ToChar16   SafeInt64ToUint16

◆ SafeInt8ToChar16

#define SafeInt8ToChar16   SafeInt8ToUint16

◆ SafeIntnToChar16

#define SafeIntnToChar16   SafeIntnToUint16

◆ SafeUint32ToChar16

#define SafeUint32ToChar16   SafeUint32ToUint16

◆ SafeUint64ToChar16

#define SafeUint64ToChar16   SafeUint64ToUint16

◆ SafeUintnToChar16

#define SafeUintnToChar16   SafeUintnToUint16

◆ UINT16_ERROR

#define UINT16_ERROR   MAX_UINT16

◆ UINT32_ERROR

#define UINT32_ERROR   MAX_UINT32

◆ UINT64_ERROR

#define UINT64_ERROR   MAX_UINT64

◆ UINT8_ERROR

#define UINT8_ERROR   MAX_UINT8

◆ UINTN_ERROR

#define UINTN_ERROR   MAX_UINTN

Function Documentation

◆ SafeChar8Add()

RETURN_STATUS EFIAPI SafeChar8Add ( IN CHAR8  Augend,
IN CHAR8  Addend,
OUT CHAR8 Result 
)

CHAR8 Addition

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

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.

Parameters
[in]AugendA number to which addend will be added
[in]AddendA number to be added to another
[out]ResultPointer to the result of addition
Return values
RETURN_SUCCESSSuccessful addition
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeChar8Mult()

RETURN_STATUS EFIAPI SafeChar8Mult ( IN CHAR8  Multiplicand,
IN CHAR8  Multiplier,
OUT CHAR8 Result 
)

CHAR8 multiplication

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

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.

Parameters
[in]MultiplicandA number that is to be multiplied by another
[in]MultiplierA number by which the multiplicand is to be multiplied
[out]ResultPointer to the result of multiplication
Return values
RETURN_SUCCESSSuccessful multiplication
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeChar8Sub()

RETURN_STATUS EFIAPI SafeChar8Sub ( IN CHAR8  Minuend,
IN CHAR8  Subtrahend,
OUT CHAR8 Result 
)

CHAR8 Subtraction

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

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.

Parameters
[in]MinuendA number from which another is to be subtracted.
[in]SubtrahendA number to be subtracted from another
[out]ResultPointer to the result of subtraction
Return values
RETURN_SUCCESSSuccessful subtraction
RETURN_BUFFER_TOO_SMALLUnderflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt16Add()

RETURN_STATUS EFIAPI SafeInt16Add ( IN INT16  Augend,
IN INT16  Addend,
OUT INT16 Result 
)

INT16 Addition

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]AugendA number to which addend will be added
[in]AddendA number to be added to another
[out]ResultPointer to the result of addition
Return values
RETURN_SUCCESSSuccessful addition
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt16Mult()

RETURN_STATUS EFIAPI SafeInt16Mult ( IN INT16  Multiplicand,
IN INT16  Multiplier,
OUT INT16 Result 
)

INT16 multiplication

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]MultiplicandA number that is to be multiplied by another
[in]MultiplierA number by which the multiplicand is to be multiplied
[out]ResultPointer to the result of multiplication
Return values
RETURN_SUCCESSSuccessful multiplication
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt16Sub()

RETURN_STATUS EFIAPI SafeInt16Sub ( IN INT16  Minuend,
IN INT16  Subtrahend,
OUT INT16 Result 
)

INT16 Subtraction

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]MinuendA number from which another is to be subtracted.
[in]SubtrahendA number to be subtracted from another
[out]ResultPointer to the result of subtraction
Return values
RETURN_SUCCESSSuccessful subtraction
RETURN_BUFFER_TOO_SMALLUnderflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt16ToChar8()

RETURN_STATUS EFIAPI SafeInt16ToChar8 ( IN INT16  Operand,
OUT CHAR8 Result 
)

INT16 -> CHAR8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt16ToInt8()

RETURN_STATUS EFIAPI SafeInt16ToInt8 ( IN INT16  Operand,
OUT INT8 Result 
)

INT16 -> INT8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt16ToUint16()

RETURN_STATUS EFIAPI SafeInt16ToUint16 ( IN INT16  Operand,
OUT UINT16 Result 
)

INT16 -> UINT16 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt16ToUint32()

RETURN_STATUS EFIAPI SafeInt16ToUint32 ( IN INT16  Operand,
OUT UINT32 Result 
)

INT16 -> UINT32 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

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.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt16ToUint64()

RETURN_STATUS EFIAPI SafeInt16ToUint64 ( IN INT16  Operand,
OUT UINT64 Result 
)

INT16 -> UINT64 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt16ToUint8()

RETURN_STATUS EFIAPI SafeInt16ToUint8 ( IN INT16  Operand,
OUT UINT8 Result 
)

INT16 -> UINT8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

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.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt16ToUintn()

RETURN_STATUS EFIAPI SafeInt16ToUintn ( IN INT16  Operand,
OUT UINTN Result 
)

INT16 -> UINTN conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt32Add()

RETURN_STATUS EFIAPI SafeInt32Add ( IN INT32  Augend,
IN INT32  Addend,
OUT INT32 Result 
)

INT32 Addition

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]AugendA number to which addend will be added
[in]AddendA number to be added to another
[out]ResultPointer to the result of addition
Return values
RETURN_SUCCESSSuccessful addition
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt32Mult()

RETURN_STATUS EFIAPI SafeInt32Mult ( IN INT32  Multiplicand,
IN INT32  Multiplier,
OUT INT32 Result 
)

INT32 multiplication

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]MultiplicandA number that is to be multiplied by another
[in]MultiplierA number by which the multiplicand is to be multiplied
[out]ResultPointer to the result of multiplication
Return values
RETURN_SUCCESSSuccessful multiplication
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt32Sub()

RETURN_STATUS EFIAPI SafeInt32Sub ( IN INT32  Minuend,
IN INT32  Subtrahend,
OUT INT32 Result 
)

INT32 Subtraction

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]MinuendA number from which another is to be subtracted.
[in]SubtrahendA number to be subtracted from another
[out]ResultPointer to the result of subtraction
Return values
RETURN_SUCCESSSuccessful subtraction
RETURN_BUFFER_TOO_SMALLUnderflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt32ToChar8()

RETURN_STATUS EFIAPI SafeInt32ToChar8 ( IN INT32  Operand,
OUT CHAR8 Result 
)

INT32 -> CHAR8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt32ToInt16()

RETURN_STATUS EFIAPI SafeInt32ToInt16 ( IN INT32  Operand,
OUT INT16 Result 
)

INT32 -> INT16 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt32ToInt8()

RETURN_STATUS EFIAPI SafeInt32ToInt8 ( IN INT32  Operand,
OUT INT8 Result 
)

INT32 -> INT8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt32ToUint16()

RETURN_STATUS EFIAPI SafeInt32ToUint16 ( IN INT32  Operand,
OUT UINT16 Result 
)

INT32 -> UINT16 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt32ToUint32()

RETURN_STATUS EFIAPI SafeInt32ToUint32 ( IN INT32  Operand,
OUT UINT32 Result 
)

INT32 -> UINT32 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

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.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt32ToUint64()

RETURN_STATUS EFIAPI SafeInt32ToUint64 ( IN INT32  Operand,
OUT UINT64 Result 
)

INT32 -> UINT64 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt32ToUint8()

RETURN_STATUS EFIAPI SafeInt32ToUint8 ( IN INT32  Operand,
OUT UINT8 Result 
)

INT32 -> UINT8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

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.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt32ToUintn()

RETURN_STATUS EFIAPI SafeInt32ToUintn ( IN INT32  Operand,
OUT UINTN Result 
)

INT32 -> UINTN conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt64Add()

RETURN_STATUS EFIAPI SafeInt64Add ( IN INT64  Augend,
IN INT64  Addend,
OUT INT64 Result 
)

INT64 Addition

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]AugendA number to which addend will be added
[in]AddendA number to be added to another
[out]ResultPointer to the result of addition
Return values
RETURN_SUCCESSSuccessful addition
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt64Mult()

RETURN_STATUS EFIAPI SafeInt64Mult ( IN INT64  Multiplicand,
IN INT64  Multiplier,
OUT INT64 Result 
)

INT64 multiplication

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]MultiplicandA number that is to be multiplied by another
[in]MultiplierA number by which the multiplicand is to be multiplied
[out]ResultPointer to the result of multiplication
Return values
RETURN_SUCCESSSuccessful multiplication
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt64Sub()

RETURN_STATUS EFIAPI SafeInt64Sub ( IN INT64  Minuend,
IN INT64  Subtrahend,
OUT INT64 Result 
)

INT64 Subtraction

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]MinuendA number from which another is to be subtracted.
[in]SubtrahendA number to be subtracted from another
[out]ResultPointer to the result of subtraction
Return values
RETURN_SUCCESSSuccessful subtraction
RETURN_BUFFER_TOO_SMALLUnderflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt64ToChar8()

RETURN_STATUS EFIAPI SafeInt64ToChar8 ( IN INT64  Operand,
OUT CHAR8 Result 
)

INT64 -> CHAR8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt64ToInt16()

RETURN_STATUS EFIAPI SafeInt64ToInt16 ( IN INT64  Operand,
OUT INT16 Result 
)

INT64 -> INT16 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt64ToInt32()

RETURN_STATUS EFIAPI SafeInt64ToInt32 ( IN INT64  Operand,
OUT INT32 Result 
)

INT64 -> INT32 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt64ToInt8()

RETURN_STATUS EFIAPI SafeInt64ToInt8 ( IN INT64  Operand,
OUT INT8 Result 
)

INT64 -> INT8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt64ToIntn()

RETURN_STATUS EFIAPI SafeInt64ToIntn ( IN INT64  Operand,
OUT INTN Result 
)

INT64 -> INTN conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt64ToUint16()

RETURN_STATUS EFIAPI SafeInt64ToUint16 ( IN INT64  Operand,
OUT UINT16 Result 
)

INT64 -> UINT16 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt64ToUint32()

RETURN_STATUS EFIAPI SafeInt64ToUint32 ( IN INT64  Operand,
OUT UINT32 Result 
)

INT64 -> UINT32 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

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.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt64ToUint64()

RETURN_STATUS EFIAPI SafeInt64ToUint64 ( IN INT64  Operand,
OUT UINT64 Result 
)

INT64 -> UINT64 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt64ToUint8()

RETURN_STATUS EFIAPI SafeInt64ToUint8 ( IN INT64  Operand,
OUT UINT8 Result 
)

INT64 -> UINT8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

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.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt64ToUintn()

RETURN_STATUS EFIAPI SafeInt64ToUintn ( IN INT64  Operand,
OUT UINTN Result 
)

INT64 -> UINTN conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt8Add()

RETURN_STATUS EFIAPI SafeInt8Add ( IN INT8  Augend,
IN INT8  Addend,
OUT INT8 Result 
)

INT8 Addition

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]AugendA number to which addend will be added
[in]AddendA number to be added to another
[out]ResultPointer to the result of addition
Return values
RETURN_SUCCESSSuccessful addition
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt8Mult()

RETURN_STATUS EFIAPI SafeInt8Mult ( IN INT8  Multiplicand,
IN INT8  Multiplier,
OUT INT8 Result 
)

INT8 multiplication

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]MultiplicandA number that is to be multiplied by another
[in]MultiplierA number by which the multiplicand is to be multiplied
[out]ResultPointer to the result of multiplication
Return values
RETURN_SUCCESSSuccessful multiplication
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt8Sub()

RETURN_STATUS EFIAPI SafeInt8Sub ( IN INT8  Minuend,
IN INT8  Subtrahend,
OUT INT8 Result 
)

INT8 Subtraction

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]MinuendA number from which another is to be subtracted.
[in]SubtrahendA number to be subtracted from another
[out]ResultPointer to the result of subtraction
Return values
RETURN_SUCCESSSuccessful subtraction
RETURN_BUFFER_TOO_SMALLUnderflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt8ToChar8()

RETURN_STATUS EFIAPI SafeInt8ToChar8 ( IN INT8  Operand,
OUT CHAR8 Result 
)

INT8 -> CHAR8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt8ToUint16()

RETURN_STATUS EFIAPI SafeInt8ToUint16 ( IN INT8  Operand,
OUT UINT16 Result 
)

INT8 -> UINT16 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt8ToUint32()

RETURN_STATUS EFIAPI SafeInt8ToUint32 ( IN INT8  Operand,
OUT UINT32 Result 
)

INT8 -> UINT32 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

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.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt8ToUint64()

RETURN_STATUS EFIAPI SafeInt8ToUint64 ( IN INT8  Operand,
OUT UINT64 Result 
)

INT8 -> UINT64 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt8ToUint8()

RETURN_STATUS EFIAPI SafeInt8ToUint8 ( IN INT8  Operand,
OUT UINT8 Result 
)

INT8 -> UINT8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

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.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeInt8ToUintn()

RETURN_STATUS EFIAPI SafeInt8ToUintn ( IN INT8  Operand,
OUT UINTN Result 
)

INT8 -> UINTN conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeIntnAdd()

RETURN_STATUS EFIAPI SafeIntnAdd ( IN INTN  Augend,
IN INTN  Addend,
OUT INTN Result 
)

INTN Addition

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]AugendA number to which addend will be added
[in]AddendA number to be added to another
[out]ResultPointer to the result of addition
Return values
RETURN_SUCCESSSuccessful addition
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeIntnMult()

RETURN_STATUS EFIAPI SafeIntnMult ( IN INTN  Multiplicand,
IN INTN  Multiplier,
OUT INTN Result 
)

INTN multiplication

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]MultiplicandA number that is to be multiplied by another
[in]MultiplierA number by which the multiplicand is to be multiplied
[out]ResultPointer to the result of multiplication
Return values
RETURN_SUCCESSSuccessful multiplication
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeIntnSub()

RETURN_STATUS EFIAPI SafeIntnSub ( IN INTN  Minuend,
IN INTN  Subtrahend,
OUT INTN Result 
)

INTN Subtraction

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]MinuendA number from which another is to be subtracted.
[in]SubtrahendA number to be subtracted from another
[out]ResultPointer to the result of subtraction
Return values
RETURN_SUCCESSSuccessful subtraction
RETURN_BUFFER_TOO_SMALLUnderflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeIntnToChar8()

RETURN_STATUS EFIAPI SafeIntnToChar8 ( IN INTN  Operand,
OUT CHAR8 Result 
)

INTN -> CHAR8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeIntnToInt16()

RETURN_STATUS EFIAPI SafeIntnToInt16 ( IN INTN  Operand,
OUT INT16 Result 
)

INTN -> INT16 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeIntnToInt32()

RETURN_STATUS EFIAPI SafeIntnToInt32 ( IN INTN  Operand,
OUT INT32 Result 
)

INTN -> INT32 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeIntnToInt8()

RETURN_STATUS EFIAPI SafeIntnToInt8 ( IN INTN  Operand,
OUT INT8 Result 
)

INTN -> INT8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeIntnToUint16()

RETURN_STATUS EFIAPI SafeIntnToUint16 ( IN INTN  Operand,
OUT UINT16 Result 
)

INTN -> UINT16 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeIntnToUint32()

RETURN_STATUS EFIAPI SafeIntnToUint32 ( IN INTN  Operand,
OUT UINT32 Result 
)

INTN -> UINT32 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

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.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeIntnToUint64()

RETURN_STATUS EFIAPI SafeIntnToUint64 ( IN INTN  Operand,
OUT UINT64 Result 
)

INTN -> UINT64 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeIntnToUint8()

RETURN_STATUS EFIAPI SafeIntnToUint8 ( IN INTN  Operand,
OUT UINT8 Result 
)

INTN -> UINT8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

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.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeIntnToUintn()

RETURN_STATUS EFIAPI SafeIntnToUintn ( IN INTN  Operand,
OUT UINTN Result 
)

INTN -> UINTN conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint16Add()

RETURN_STATUS EFIAPI SafeUint16Add ( IN UINT16  Augend,
IN UINT16  Addend,
OUT UINT16 Result 
)

UINT16 addition

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]AugendA number to which addend will be added
[in]AddendA number to be added to another
[out]ResultPointer to the result of addition
Return values
RETURN_SUCCESSSuccessful addition
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint16Mult()

RETURN_STATUS EFIAPI SafeUint16Mult ( IN UINT16  Multiplicand,
IN UINT16  Multiplier,
OUT UINT16 Result 
)

UINT16 multiplication

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]MultiplicandA number that is to be multiplied by another
[in]MultiplierA number by which the multiplicand is to be multiplied
[out]ResultPointer to the result of multiplication
Return values
RETURN_SUCCESSSuccessful multiplication
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint16Sub()

RETURN_STATUS EFIAPI SafeUint16Sub ( IN UINT16  Minuend,
IN UINT16  Subtrahend,
OUT UINT16 Result 
)

UINT16 subtraction

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]MinuendA number from which another is to be subtracted.
[in]SubtrahendA number to be subtracted from another
[out]ResultPointer to the result of subtraction
Return values
RETURN_SUCCESSSuccessful subtraction
RETURN_BUFFER_TOO_SMALLUnderflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint16ToChar8()

RETURN_STATUS EFIAPI SafeUint16ToChar8 ( IN UINT16  Operand,
OUT CHAR8 Result 
)

UINT16 -> CHAR8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint16ToInt16()

RETURN_STATUS EFIAPI SafeUint16ToInt16 ( IN UINT16  Operand,
OUT INT16 Result 
)

UINT16 -> INT16 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint16ToInt8()

RETURN_STATUS EFIAPI SafeUint16ToInt8 ( IN UINT16  Operand,
OUT INT8 Result 
)

UINT16 -> INT8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint16ToUint8()

RETURN_STATUS EFIAPI SafeUint16ToUint8 ( IN UINT16  Operand,
OUT UINT8 Result 
)

UINT16 -> UINT8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

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.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint32Add()

RETURN_STATUS EFIAPI SafeUint32Add ( IN UINT32  Augend,
IN UINT32  Addend,
OUT UINT32 Result 
)

UINT32 addition

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]AugendA number to which addend will be added
[in]AddendA number to be added to another
[out]ResultPointer to the result of addition
Return values
RETURN_SUCCESSSuccessful addition
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint32Mult()

RETURN_STATUS EFIAPI SafeUint32Mult ( IN UINT32  Multiplicand,
IN UINT32  Multiplier,
OUT UINT32 Result 
)

UINT32 multiplication

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]MultiplicandA number that is to be multiplied by another
[in]MultiplierA number by which the multiplicand is to be multiplied
[out]ResultPointer to the result of multiplication
Return values
RETURN_SUCCESSSuccessful multiplication
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint32Sub()

RETURN_STATUS EFIAPI SafeUint32Sub ( IN UINT32  Minuend,
IN UINT32  Subtrahend,
OUT UINT32 Result 
)

UINT32 subtraction

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]MinuendA number from which another is to be subtracted.
[in]SubtrahendA number to be subtracted from another
[out]ResultPointer to the result of subtraction
Return values
RETURN_SUCCESSSuccessful subtraction
RETURN_BUFFER_TOO_SMALLUnderflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint32ToChar8()

RETURN_STATUS EFIAPI SafeUint32ToChar8 ( IN UINT32  Operand,
OUT CHAR8 Result 
)

UINT32 -> CHAR8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint32ToInt16()

RETURN_STATUS EFIAPI SafeUint32ToInt16 ( IN UINT32  Operand,
OUT INT16 Result 
)

UINT32 -> INT16 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint32ToInt32()

RETURN_STATUS EFIAPI SafeUint32ToInt32 ( IN UINT32  Operand,
OUT INT32 Result 
)

UINT32 -> INT32 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint32ToInt8()

RETURN_STATUS EFIAPI SafeUint32ToInt8 ( IN UINT32  Operand,
OUT INT8 Result 
)

UINT32 -> INT8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint32ToIntn()

RETURN_STATUS EFIAPI SafeUint32ToIntn ( IN UINT32  Operand,
OUT INTN Result 
)

UINT32 -> INTN conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint32ToUint16()

RETURN_STATUS EFIAPI SafeUint32ToUint16 ( IN UINT32  Operand,
OUT UINT16 Result 
)

UINT32 -> UINT16 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint32ToUint8()

RETURN_STATUS EFIAPI SafeUint32ToUint8 ( IN UINT32  Operand,
OUT UINT8 Result 
)

UINT32 -> UINT8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

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.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint64Add()

RETURN_STATUS EFIAPI SafeUint64Add ( IN UINT64  Augend,
IN UINT64  Addend,
OUT UINT64 Result 
)

UINT64 addition

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]AugendA number to which addend will be added
[in]AddendA number to be added to another
[out]ResultPointer to the result of addition
Return values
RETURN_SUCCESSSuccessful addition
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint64Mult()

RETURN_STATUS EFIAPI SafeUint64Mult ( IN UINT64  Multiplicand,
IN UINT64  Multiplier,
OUT UINT64 Result 
)

UINT64 multiplication

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]MultiplicandA number that is to be multiplied by another
[in]MultiplierA number by which the multiplicand is to be multiplied
[out]ResultPointer to the result of multiplication
Return values
RETURN_SUCCESSSuccessful multiplication
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint64Sub()

RETURN_STATUS EFIAPI SafeUint64Sub ( IN UINT64  Minuend,
IN UINT64  Subtrahend,
OUT UINT64 Result 
)

UINT64 subtraction

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]MinuendA number from which another is to be subtracted.
[in]SubtrahendA number to be subtracted from another
[out]ResultPointer to the result of subtraction
Return values
RETURN_SUCCESSSuccessful subtraction
RETURN_BUFFER_TOO_SMALLUnderflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint64ToChar8()

RETURN_STATUS EFIAPI SafeUint64ToChar8 ( IN UINT64  Operand,
OUT CHAR8 Result 
)

UINT64 -> CHAR8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint64ToInt16()

RETURN_STATUS EFIAPI SafeUint64ToInt16 ( IN UINT64  Operand,
OUT INT16 Result 
)

UINT64 -> INT16 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint64ToInt32()

RETURN_STATUS EFIAPI SafeUint64ToInt32 ( IN UINT64  Operand,
OUT INT32 Result 
)

UINT64 -> INT32 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint64ToInt64()

RETURN_STATUS EFIAPI SafeUint64ToInt64 ( IN UINT64  Operand,
OUT INT64 Result 
)

UINT64 -> INT64 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint64ToInt8()

RETURN_STATUS EFIAPI SafeUint64ToInt8 ( IN UINT64  Operand,
OUT INT8 Result 
)

UINT64 -> INT8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint64ToIntn()

RETURN_STATUS EFIAPI SafeUint64ToIntn ( IN UINT64  Operand,
OUT INTN Result 
)

UINT64 -> INTN conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint64ToUint16()

RETURN_STATUS EFIAPI SafeUint64ToUint16 ( IN UINT64  Operand,
OUT UINT16 Result 
)

UINT64 -> UINT16 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint64ToUint32()

RETURN_STATUS EFIAPI SafeUint64ToUint32 ( IN UINT64  Operand,
OUT UINT32 Result 
)

UINT64 -> UINT32 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

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.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint64ToUint8()

RETURN_STATUS EFIAPI SafeUint64ToUint8 ( IN UINT64  Operand,
OUT UINT8 Result 
)

UINT64 -> UINT8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

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.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint64ToUintn()

RETURN_STATUS EFIAPI SafeUint64ToUintn ( IN UINT64  Operand,
OUT UINTN Result 
)

UINT64 -> UINTN conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint8Add()

RETURN_STATUS EFIAPI SafeUint8Add ( IN UINT8  Augend,
IN UINT8  Addend,
OUT UINT8 Result 
)

UINT8 addition

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]AugendA number to which addend will be added
[in]AddendA number to be added to another
[out]ResultPointer to the result of addition
Return values
RETURN_SUCCESSSuccessful addition
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint8Mult()

RETURN_STATUS EFIAPI SafeUint8Mult ( IN UINT8  Multiplicand,
IN UINT8  Multiplier,
OUT UINT8 Result 
)

UINT8 multiplication

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]MultiplicandA number that is to be multiplied by another
[in]MultiplierA number by which the multiplicand is to be multiplied
[out]ResultPointer to the result of multiplication
Return values
RETURN_SUCCESSSuccessful multiplication
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint8Sub()

RETURN_STATUS EFIAPI SafeUint8Sub ( IN UINT8  Minuend,
IN UINT8  Subtrahend,
OUT UINT8 Result 
)

UINT8 subtraction

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]MinuendA number from which another is to be subtracted.
[in]SubtrahendA number to be subtracted from another
[out]ResultPointer to the result of subtraction
Return values
RETURN_SUCCESSSuccessful subtraction
RETURN_BUFFER_TOO_SMALLUnderflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint8ToChar8()

RETURN_STATUS EFIAPI SafeUint8ToChar8 ( IN UINT8  Operand,
OUT CHAR8 Result 
)

UINT8 -> CHAR8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUint8ToInt8()

RETURN_STATUS EFIAPI SafeUint8ToInt8 ( IN UINT8  Operand,
OUT INT8 Result 
)

UINT8 -> INT8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUintnAdd()

RETURN_STATUS EFIAPI SafeUintnAdd ( IN UINTN  Augend,
IN UINTN  Addend,
OUT UINTN Result 
)

UINTN addition

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]AugendA number to which addend will be added
[in]AddendA number to be added to another
[out]ResultPointer to the result of addition
Return values
RETURN_SUCCESSSuccessful addition
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUintnMult()

RETURN_STATUS EFIAPI SafeUintnMult ( IN UINTN  Multiplicand,
IN UINTN  Multiplier,
OUT UINTN Result 
)

UINTN multiplication

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]MultiplicandA number that is to be multiplied by another
[in]MultiplierA number by which the multiplicand is to be multiplied
[out]ResultPointer to the result of multiplication
Return values
RETURN_SUCCESSSuccessful multiplication
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUintnSub()

RETURN_STATUS EFIAPI SafeUintnSub ( IN UINTN  Minuend,
IN UINTN  Subtrahend,
OUT UINTN Result 
)

UINTN subtraction

Performs the requested operation using the input parameters into a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the requested operation results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]MinuendA number from which another is to be subtracted.
[in]SubtrahendA number to be subtracted from another
[out]ResultPointer to the result of subtraction
Return values
RETURN_SUCCESSSuccessful subtraction
RETURN_BUFFER_TOO_SMALLUnderflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUintnToChar8()

RETURN_STATUS EFIAPI SafeUintnToChar8 ( IN UINTN  Operand,
OUT CHAR8 Result 
)

UINTN -> CHAR8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to CHAR8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUintnToInt16()

RETURN_STATUS EFIAPI SafeUintnToInt16 ( IN UINTN  Operand,
OUT INT16 Result 
)

UINTN -> INT16 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUintnToInt32()

RETURN_STATUS EFIAPI SafeUintnToInt32 ( IN UINTN  Operand,
OUT INT32 Result 
)

UINTN -> INT32 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUintnToInt64()

RETURN_STATUS EFIAPI SafeUintnToInt64 ( IN UINTN  Operand,
OUT INT64 Result 
)

UINTN -> INT64 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUintnToInt8()

RETURN_STATUS EFIAPI SafeUintnToInt8 ( IN UINTN  Operand,
OUT INT8 Result 
)

UINTN -> INT8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUintnToIntn()

RETURN_STATUS EFIAPI SafeUintnToIntn ( IN UINTN  Operand,
OUT INTN Result 
)

UINTN -> INTN conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUintnToUint16()

RETURN_STATUS EFIAPI SafeUintnToUint16 ( IN UINTN  Operand,
OUT UINT16 Result 
)

UINTN -> UINT16 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

If the conversion results in an overflow or an underflow condition, then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUintnToUint32()

RETURN_STATUS EFIAPI SafeUintnToUint32 ( IN UINTN  Operand,
OUT UINT32 Result 
)

UINTN -> UINT32 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

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.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL

◆ SafeUintnToUint8()

RETURN_STATUS EFIAPI SafeUintnToUint8 ( IN UINTN  Operand,
OUT UINT8 Result 
)

UINTN -> UINT8 conversion

Converts the value specified by Operand to a value specified by Result type and stores the converted value into the caller allocated output buffer specified by Result. The caller must pass in a Result buffer that is at least as large as the Result type.

If Result is NULL, RETURN_INVALID_PARAMETER is returned.

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.

Parameters
[in]OperandOperand to be converted to new type
[out]ResultPointer to the result of conversion
Return values
RETURN_SUCCESSSuccessful conversion
RETURN_BUFFER_TOO_SMALLOverflow
RETURN_INVALID_PARAMETERResult is NULL