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

Classes

struct  etl::log< NV, BASE >
 
struct  etl::log2< NV >
 
struct  etl::log10< NV >
 

Detailed Description

log<N, BASE> : Calculates logs to any base, rounded down to the nearest integer.
log2<N> : Calculates logs to base 2, rounded down to the nearest integer.
log10<N> : Calculates logs to base 10, rounded down to the nearest integer.


Class Documentation

◆ etl::log

struct etl::log
template<size_t NV, size_t BASE>
struct etl::log< NV, BASE >

The base generic log template. Defines value as the log of the number at the specified base. The result is rounded down to the next integer.

Template Parameters
NVThe number to find the log of.
BASEThe base of the log.

Public Types

enum  value_type { value = (NV >= BASE) ? 1 + log<NV / BASE, BASE>::value : 0 }
 

◆ etl::log2

struct etl::log2
template<size_t NV>
struct etl::log2< NV >

Calculates base 2 logs.

Public Types

enum  value_type { value = log<NV, 2>::value }
 

◆ etl::log10

struct etl::log10
template<size_t NV>
struct etl::log10< NV >

Calculates base 10 logs.

Public Types

enum  value_type { value = log<NV, 10>::value }