Application Programming Interface for ArrayAllocators.ByteCalculators
ArrayAllocators.ByteCalculators
— ModuleArrayAllocators.ByteCalculators
Defines calculators for computing the number of bytes needed to allocate an array while detecting integer overflow.
Examples
using ArrayAllocators.ByteCalculators
bc = CheckedMulByteCalculator{UInt8}(1024, 2048)
elsize(bc)
nbytes(bc)
Default Byte Calculator
ArrayAllocators.ByteCalculators.CheckedMulByteCalculator
— TypeCheckedMulByteCalculator
Calculate the number of bytes by using Base.checked_mul
to check if the product of the dimensions (length) or the product of the length and the element size will cause an integer overflow.
Alternative Byte Calculators
ArrayAllocators.ByteCalculators.WideningByteCalculator
— TypeWideningByteCalculator
Widens eltype(Dims)
, Int in order to catch integer overflow.
ArrayAllocators.ByteCalculators.UnsafeByteCalculator
— TypeUnsafeByteCalculator
Calculate number of bytes to allocate for an array without any integer overflow checking.
SafeByteCalculators.SafeByteCalculators
— ModuleSafeByteCalculators
Extension of ArrayAllocators.ByteCalculators
using SaferIntegers.jl.
SafeByteCalculators.SafeByteCalculator
— TypeSafeByteCalculator
Use SafeInt
from SaferIntegers.jl to calculate the number of bytes to allocate for an Array.
Abstract Type
ArrayAllocators.ByteCalculators.AbstractByteCalculator
— TypeAbstractByteCalculator
Parent abstract type for byte calculators, which calculate the total number of bytes of memory to allocate.