#ifndef CDO_MATH_H
#define CDO_MATH_H

#include <span>

// clang-format off
namespace cdo
{
  constexpr double sqr(double x) noexcept { return x * x; }
  constexpr double sqr_distance(std::span<const double, 3> a, std::span<const double, 3> b) noexcept
  {
    return sqr(a[0] - b[0]) + sqr(a[1] - b[1]) + sqr(a[2] - b[2]);
  }
  constexpr bool is_power_of_two(int n) noexcept
  {
    return (n > 0 && (n & (n - 1)) == 0);
  }

  double NaN();
}
// clang-format on

#endif
