Documentation
¶
Overview ¶
go-overflow is a simple library to check for integer overflow in Go.
Index ¶
- func AddInt16(a, b int16) (int16, bool)
- func AddInt32(a, b int32) (int32, bool)
- func AddInt64(a, b int64) (int64, bool)
- func AddInt8(a, b int8) (int8, bool)
- func AddUint16(a, b uint16) (uint16, bool)
- func AddUint32(a, b uint32) (uint32, bool)
- func AddUint64(a, b uint64) (uint64, bool)
- func AddUint8(a, b uint8) (uint8, bool)
- func DivInt16(a, b int16) (int16, bool)
- func DivInt32(a, b int32) (int32, bool)
- func DivInt64(a, b int64) (int64, bool)
- func DivInt8(a, b int8) (int8, bool)
- func MulInt16(a, b int16) (int16, bool)
- func MulInt32(a, b int32) (int32, bool)
- func MulInt64(a, b int64) (int64, bool)
- func MulInt8(a, b int8) (int8, bool)
- func MulUint16(a, b uint16) (uint16, bool)
- func MulUint32(a, b uint32) (uint32, bool)
- func MulUint64(a, b uint64) (uint64, bool)
- func MulUint8(a, b uint8) (uint8, bool)
- func SubInt16(a, b int16) (int16, bool)
- func SubInt32(a, b int32) (int32, bool)
- func SubInt64(a, b int64) (int64, bool)
- func SubInt8(a, b int8) (int8, bool)
- func SubUint16(a, b uint16) (uint16, bool)
- func SubUint32(a, b uint32) (uint32, bool)
- func SubUint64(a, b uint64) (uint64, bool)
- func SubUint8(a, b uint8) (uint8, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddInt16 ¶
AddInt16 adds two int16 values and checks for overflow. Returns the result and a boolean indicating if overflow occurred.
func AddInt32 ¶
AddInt32 adds two int32 values and checks for overflow. Returns the result and a boolean indicating if overflow occurred.
func AddInt64 ¶
AddInt64 adds two int64 values and checks for overflow. Returns the result and a boolean indicating if overflow occurred.
func AddInt8 ¶
AddInt8 adds two int8 values and checks for overflow. Returns the result and a boolean indicating if overflow occurred.
func AddUint16 ¶
AddUint16 adds two uint16 values and checks for overflow. Returns the result and a boolean indicating if overflow occurred.
func AddUint32 ¶
AddUint32 adds two uint32 values and checks for overflow. Returns the result and a boolean indicating if overflow occurred.
func AddUint64 ¶
AddUint64 adds two uint64 values and checks for overflow. Returns the result and a boolean indicating if overflow occurred.
func AddUint8 ¶
AddUint8 adds two uint8 values and checks for overflow. Returns the result and a boolean indicating if overflow occurred.
func DivInt16 ¶
DivInt16 divides two int16 values and checks for division by zero or overflow. Returns the result and a boolean indicating if an error occurred. Integer division overflows in one specific case: dividing the smallest negative value for the data type (see Maximum and Minimum Values) by -1. That’s because the correct result, which is the corresponding positive number, does not fit (see Integer Overflow) in the same number of bits. Source: https://www.gnu.org/software/c-intro-and-ref/manual/html_node/Division-and-Remainder.html
func DivInt32 ¶
DivInt32 divides two int32 values and checks for division by zero or overflow. Returns the result and a boolean indicating if an error occurred. Integer division overflows in one specific case: dividing the smallest negative value for the data type (see Maximum and Minimum Values) by -1. That’s because the correct result, which is the corresponding positive number, does not fit (see Integer Overflow) in the same number of bits. Source: https://www.gnu.org/software/c-intro-and-ref/manual/html_node/Division-and-Remainder.html
func DivInt64 ¶
DivInt64 divides two int64 values and checks for division by zero or overflow. Returns the result and a boolean indicating if an error occurred. Integer division overflows in one specific case: dividing the smallest negative value for the data type (see Maximum and Minimum Values) by -1. That’s because the correct result, which is the corresponding positive number, does not fit (see Integer Overflow) in the same number of bits. Source: https://www.gnu.org/software/c-intro-and-ref/manual/html_node/Division-and-Remainder.html
func DivInt8 ¶
DivInt8 divides two int8 values and checks for division by zero or overflow. Returns the result and a boolean indicating if an error occurred. Integer division overflows in one specific case: dividing the smallest negative value for the data type (see Maximum and Minimum Values) by -1. That’s because the correct result, which is the corresponding positive number, does not fit (see Integer Overflow) in the same number of bits. Source: https://www.gnu.org/software/c-intro-and-ref/manual/html_node/Division-and-Remainder.html
func MulInt16 ¶
MulInt16 multiplies two int16 values and checks for overflow. Returns the result and a boolean indicating if overflow occurred.
func MulInt32 ¶
MulInt32 multiplies two int32 values and checks for overflow. Returns the result and a boolean indicating if overflow occurred.
func MulInt64 ¶
MulInt64 multiplies two int64 values and checks for overflow. Returns the result and a boolean indicating if overflow occurred.
func MulInt8 ¶
MulInt8 multiplies two int8 values and checks for overflow. Returns the result and a boolean indicating if overflow occurred.
func MulUint16 ¶
MulUint16 multiplies two uint16 values and checks for overflow. Returns the result and a boolean indicating if overflow occurred.
func MulUint32 ¶
MulUint32 multiplies two uint32 values and checks for overflow. Returns the result and a boolean indicating if overflow occurred.
func MulUint64 ¶
MulUint64 multiplies two uint64 values and checks for overflow. Returns the result and a boolean indicating if overflow occurred.
func MulUint8 ¶
MulUint8 multiplies two uint8 values and checks for overflow. Returns the result and a boolean indicating if overflow occurred.
func SubInt16 ¶
SubInt16 subtracts two int16 values and checks for underflow. Returns the result and a boolean indicating if underflow occurred.
func SubInt32 ¶
SubInt32 subtracts two int32 values and checks for underflow. Returns the result and a boolean indicating if underflow occurred.
func SubInt64 ¶
SubInt64 subtracts two int64 values and checks for underflow. Returns the result and a boolean indicating if underflow occurred.
func SubInt8 ¶
SubInt8 subtracts two int8 values and checks for underflow. Returns the result and a boolean indicating if underflow occurred.
func SubUint16 ¶
SubUint16 subtracts two uint16 values and checks for underflow. Returns the result and a boolean indicating if underflow occurred.
func SubUint32 ¶
SubUint32 subtracts two uint32 values and checks for underflow. Returns the result and a boolean indicating if underflow occurred.
Types ¶
This section is empty.