SaturnRingLibrary 0.7
SGL wrapper
 
Loading...
Searching...
No Matches
SRL::Math::Integer Class Referencefinal

Detailed Description

Integer-specific utility functions optimized for performance.

#include <utils.hpp>

Static Public Member Functions

static constexpr uint32_t FastSqrt (uint32_t src)
 Fast integer square root approximation with ~6% error.
 

Member Function Documentation

◆ FastSqrt()

static constexpr uint32_t SRL::Math::Integer::FastSqrt ( uint32_t src)
inlinestaticconstexpr

Fast integer square root approximation with ~6% error.

Binary search approximation supporting full uint32_t range. Maximum 15 iterations after initial right shift by 2. Ideal for games where integer precision is sufficient and performance matters more than perfect accuracy.

Parameters
srcThe 32-bit integer value.
Returns
Approximate square root as whole number.