4#ifndef TETL_CMATH_LOG2_HPP
5#define TETL_CMATH_LOG2_HPP
7#include <etl/_config/all.hpp>
9#include <etl/_3rd_party/gcem/gcem.hpp>
10#include <etl/_concepts/integral.hpp>
11#include <etl/_concepts/same_as.hpp>
12#include <etl/_type_traits/is_constant_evaluated.hpp>
18inline constexpr struct log2 {
19 template <
typename Float>
20 [[nodiscard]]
constexpr auto operator()(Float arg)
const noexcept -> Float
23#if __has_builtin(__builtin_log2f)
24 if constexpr (
etl::same_as<Float,
float>) {
25 return __builtin_log2f(arg);
28#if __has_builtin(__builtin_log2)
29 if constexpr (
etl::same_as<Float,
double>) {
30 return __builtin_log2(arg);
34 return etl::detail::gcem::log2(arg);
47 return etl::detail::log2(arg);
51 return etl::detail::log2(arg);
55 return etl::detail::log2(arg);
57[[
nodiscard]]
constexpr auto log2(
long double arg)
noexcept ->
long double
59 return etl::detail::log2(arg);
63 return etl::detail::log2(arg);
constexpr auto log2l(long double arg) noexcept -> long double
Definition log2.hpp:61
constexpr auto log2(double arg) noexcept -> double
Definition log2.hpp:53
constexpr auto log2(float arg) noexcept -> float
Definition log2.hpp:45
constexpr auto log2f(float arg) noexcept -> float
Definition log2.hpp:49
constexpr auto log2(long double arg) noexcept -> long double
Definition log2.hpp:57
Definition adjacent_find.hpp:9
constexpr auto is_constant_evaluated() noexcept -> bool
Detects whether the function call occurs within a constant-evaluated context. Returns true if the eva...
Definition is_constant_evaluated.hpp:17