When specifying extents, positions inside of, or bounds of a container, numeric values can be represented three different ways:
Fixedis most precise and
intis least precise. It is advised to use as precise specification as possible. The compiler may optimize better with more information.
Represent a numerical constant whose value specified at compile time.
template <int NumberT> class fixed;
If offsets applied to index values inside a SIMD loop are known at compile time, then the compiler can use that information. For example, to maintain aligned access, if boundary is fixed and known to be aligned when accessing underlying data layout. When multiple accesses are happening near each other, the compiler will have the opportunity to detect which accesses occur in the same cache lines and potentially avoid prefetching the same cache line repeatedly. Additionally, if the start of an iteration space is known at compile time, if it's a multiple of the SIMD lane count, the compiler could skip generating a peel loop. Whenever possible,
fixedvalues should be used over
alignedor arbitrary integer values.
std::integral_constant<int>provides the same functionality, the library defines own type to provide overloaded operators and avoid collisions with any other code's interactions with
The following table provides information about the template arguments for
The numerical value the fixed will represent.
The following table provides information about the members of
The numerical value known at compile-time.