Aliases for the checkedint module using the asserts IntFlagPolicy.
Common error signaling facilities for the checkedint package.
Aliases for the checkedint module using the noex IntFlagPolicy.
Test the correctness and performance of the checkedint package.
Aliases for the checkedint module using the throws IntFlagPolicy.
Templates to facilitate treating checkedint.SmartInt and checkedint.SafeInt like the built-in numeric types in generic code.
Evaluates to true if T is an instance of SafeInt or SmartInt.
Evaluates to true if T is an instance of SafeInt.
Evaluates to true if T is an instance of SmartInt.
Get the value of num as a SafeInt!N. The integral type N can be infered from the argument.
Get the value of num as a SmartInt!N. The integral type N can be infered from the argument.
Get a view or copy of num that supports bitwise operations.
Get a view or copy of num as a basic scalar.
Cast num to a basic type suitable for indexing an array.
Wrapper for any basic integral type N that uses the checked operations from safeOp and rejects attempts to directly assign values that cannot be proven to be within the range representable by N. (checkedint.to() can be used to safely assign values of incompatible types, with runtime bounds checking.)
Wrapper for any basic integral type N that uses the checked operations from smartOp and bounds checks assignments with checkedint.to().
Aliases to the basic scalar type associated with T, assuming either:
Otherwise, BasicScalar aliases to void.
template alias that evaluates to SafeInt!(N, policy, bitOps) in debug mode, and N in release mode. This way, you can use SafeInt!N to debug your integer logic in testing, but switch to basic N in release mode for maximum speed and the smallest binaries.
Wrapper for any basic integral type N that uses the checked operations from safeOp and rejects attempts to directly assign values that cannot be proven to be within the range representable by N. (checkedint.to() can be used to safely assign values of incompatible types, with runtime bounds checking.)
Wrapper for any basic integral type N that uses the checked operations from smartOp and bounds checks assignments with checkedint.to().
Evaluates to true if either:
And bitwise operators such as << and ~ are available for T.
Implements various integer math operations with error checking.
Implements various integer math operations with error checking.
A wrapper for std.conv.to() which uses checkedint.flags for error signaling when converting between any combination of basic scalar types and checkedint types. With an appropriate policy, this allows checkedint.to() to be used for numeric conversions in pure nothrow code, unlike std.conv.to().
Checked integer arithmetic operations, functions, and types with improved handling of errors and corner cases compared to the basic integral types.
Note: Normally this module should not be imported directly. Instead, import one of checkedint.throws, checkedint.asserts, or checkedint.noex, depending on which error signalling policy you want to use. (See below.)