Embedded Template Library 1.0
Loading...
Searching...
No Matches
power

Classes

struct  etl::power< Value, Power >
struct  etl::power_of_2_round_up< Value >
struct  etl::power_of_2_round_up< 0 >
struct  etl::power_of_2_round_down< Value >
struct  etl::power_of_2_round_down< 0 >
struct  etl::power_of_2_round_down< 1 >
struct  etl::power_of_2_round_down< 2 >
struct  etl::is_power_of_2< Value >
struct  etl::is_power_of_2< 0 >
struct  etl::is_power_of_2< 1 >

Detailed Description

power<N, Power> : Calculates N to the power Power.


Class Documentation

◆ etl::power

struct etl::power
template<size_t Value, size_t Power>
struct etl::power< Value, Power >

Calculates powers.

Note
Only supports positive Value.

Static Public Attributes

static ETL_CONSTANT private_power::type value = Value * power<Value, Power - 1>::value

◆ etl::power_of_2_round_up

struct etl::power_of_2_round_up
template<size_t Value>
struct etl::power_of_2_round_up< Value >

Calculates the rounded up power of 2.

Public Types

enum  value_type { value = 1 << (etl::log2<Value - 1>::value + 1) }

◆ etl::power_of_2_round_up< 0 >

struct etl::power_of_2_round_up< 0 >

Calculates the rounded up power of 2. Specialisation for 0.

Public Types

enum  value_type { value = 2 }

◆ etl::power_of_2_round_down

struct etl::power_of_2_round_down
template<size_t Value>
struct etl::power_of_2_round_down< Value >

Calculates the rounded down power of 2.

Public Types

enum  value_type { value = 1 << (etl::log2<Value - 1>::value) }

◆ etl::power_of_2_round_down< 0 >

struct etl::power_of_2_round_down< 0 >

Calculates the rounded down power of 2. Specialisation for 0.

Public Types

enum  value_type { value = 2 }

◆ etl::power_of_2_round_down< 1 >

struct etl::power_of_2_round_down< 1 >

Calculates the rounded down power of 2. Specialisation for 1.

Public Types

enum  value_type { value = 2 }

◆ etl::power_of_2_round_down< 2 >

struct etl::power_of_2_round_down< 2 >

Calculates the rounded down power of 2. Specialisation for 2.

Public Types

enum  value_type { value = 2 }

◆ etl::is_power_of_2

struct etl::is_power_of_2
template<size_t Value>
struct etl::is_power_of_2< Value >

Checks if N is a power of 2.

Static Public Attributes

static ETL_CONSTANT bool value = (Value & (Value - 1)) == 0

◆ etl::is_power_of_2< 0 >

struct etl::is_power_of_2< 0 >

Checks if N is a power of 2. Specialisation for 0.

Static Public Attributes

static ETL_CONSTANT bool value = false

◆ etl::is_power_of_2< 1 >

struct etl::is_power_of_2< 1 >

Checks if N is a power of 2. Specialisation for 1.

Static Public Attributes

static ETL_CONSTANT bool value = false