28#ifndef INCLUDED_OOMATHS_h
29 #error Do not include OOFastArithmetic.h directly; include OOMaths.h.
48 return 0x80000000U >> (__builtin_clz(value - 1) - 1);
54 return 0x8000000000000000ULL >> (__builtin_clzll(value - 1) - 1);
62 return OORoundUpToPowerOf2_64(value);
67 return OORoundUpToPowerOf2_32(value);
73OOINLINE float OOClamp_0_1_f(
float value)
75 return fmax(0.0f, fmin(value, 1.0f));
78OOINLINE float OOClamp_n1_1_f(
float value)
80 return fmax(-1.0f, fmin(value, 1.0f));
83OOINLINE double OOClamp_0_1_d(
double value)
85 return fmax(0.0f, fmin(value, 1.0f));
88OOINLINE float OOClamp_0_max_f(
float value,
float max)
90 return fmax(0.0f, fmin(value, max));
93OOINLINE double OOClamp_0_max_d(
double value,
double max)
95 return fmax(0.0, fmin(value, max));
99OOINLINE float OOLerp(
float v0,
float v1,
float fraction)
102 return v0 + fraction * (v1 - v0);
105OOINLINE double OOLerpd(
double v0,
double v1,
double fraction)
108 return v0 + fraction * (v1 - v0);
#define INLINE_CONST_FUNC