Ocean
Ocean::ProcessorInstructionChecker< tHighestInstructions, tNecessaryInstruction > Class Template Reference

This helper class allows to determine a compile-time known boolean statement whether a set of available instruction contains (included) a specified (minimal requirement) instruction. More...

Detailed Description

template<ProcessorInstructions tHighestInstructions, ProcessorInstructions tNecessaryInstruction>
class Ocean::ProcessorInstructionChecker< tHighestInstructions, tNecessaryInstruction >

This helper class allows to determine a compile-time known boolean statement whether a set of available instruction contains (included) a specified (minimal requirement) instruction.

See this tutorial:

template <ProcessorInstructions tHighestInstructions>
void function()
{
static_assert((InstructionChecker<tHighestInstructions, SSE_2>::value), "This function needs at least SSE2 instructions");
if (InstructionChecker<tHighestInstructions, SSE_4_1>::value)
{
// place code needing (at most) SSE4.1 instructions here
}
else if (InstructionChecker<tHighestInstructions, SSE_2>::value)
{
// place an alternative code using (at most) SS2 instructions here
}
}
Template Parameters
tHighestInstructionsThe set of available instructions, may be any combination of instructions
tNecessaryInstructionThe instruction that is required for a specific function (the minimal requirement), must be one specific instruction (not a set of several instructions)

The documentation for this class was generated from the following file: