24 constexpr T sqrt_helper(T x, T lo, T hi) {
25 if (lo == hi)
return lo;
27 const T mid = (lo + hi + 1) / 2;
30 return sqrt_helper<T>(x, lo, mid - 1);
32 return sqrt_helper(x, mid, hi);
45 requires std::integral<T>
46 constexpr T
ct_sqrt(T x) {
return Impl::sqrt_helper<T>(x, 0, x / 2 + 1); }
Definition: simpleassemblers.hh:21
constexpr T ct_sqrt(T x)
Compile-time square root for integer types.
Definition: math.hh:46