diff --git a/src/math/hash/pcg.hpp b/src/math/hash/pcg.hpp index 2cc2880..011935a 100644 --- a/src/math/hash/pcg.hpp +++ b/src/math/hash/pcg.hpp @@ -30,7 +30,6 @@ namespace hash { /** * Provides an unsigned integer type of equivalent size to type @p T. */ -/// @{ template struct pcg_make_uint { @@ -40,60 +39,61 @@ struct pcg_make_uint typedef typename std::make_unsigned::type type; }; +/// Provides an unsigned integer type of equivalent to `float`. template<> struct pcg_make_uint { typedef std::uint32_t type; }; +/// Provides an unsigned integer type of equivalent to `double`. template<> struct pcg_make_uint { typedef std::uint64_t type; }; +/// Helper type for pcg_make_uint. template using pcg_make_uint_t = typename pcg_make_uint::type; -/// @} /// @private -/// @{ - template constexpr T pcg_multiplier = 0; -template -constexpr T pcg_increment = 0; -template -constexpr T mcg_multiplier = 0; - template <> constexpr std::uint8_t pcg_multiplier = 141U; -template <> -constexpr std::uint8_t pcg_increment = 77U; -template <> -constexpr std::uint8_t mcg_multiplier = 217U; - template <> constexpr std::uint16_t pcg_multiplier = 12829U; template <> -constexpr std::uint16_t pcg_increment = 47989U; +constexpr std::uint32_t pcg_multiplier = 747796405UL; template <> -constexpr std::uint16_t mcg_multiplier = 62169U; +constexpr std::uint64_t pcg_multiplier = 6364136223846793005ULL; +/// @private +template +constexpr T pcg_increment = 0; template <> -constexpr std::uint32_t pcg_multiplier = 747796405UL; +constexpr std::uint8_t pcg_increment = 77U; +template <> +constexpr std::uint16_t pcg_increment = 47989U; template <> constexpr std::uint32_t pcg_increment = 2891336453UL; template <> -constexpr std::uint32_t mcg_multiplier = 277803737UL; +constexpr std::uint64_t pcg_increment = 1442695040888963407ULL; +/// @private +template +constexpr T mcg_multiplier = 0; template <> -constexpr std::uint64_t pcg_multiplier = 6364136223846793005ULL; +constexpr std::uint8_t mcg_multiplier = 217U; template <> -constexpr std::uint64_t pcg_increment = 1442695040888963407ULL; +constexpr std::uint16_t mcg_multiplier = 62169U; +template <> +constexpr std::uint32_t mcg_multiplier = 277803737UL; template <> constexpr std::uint64_t mcg_multiplier = 12605985483714917081ULL; +/// @private template constexpr T pcg_uint(T x) noexcept { @@ -105,6 +105,7 @@ constexpr T pcg_uint(T x) noexcept return x ^ (x >> ((sizeof(T) * 16 + 2) / 3)); } +/// @private template inline constexpr vector pcg_uvec1(vector x) noexcept { @@ -116,6 +117,7 @@ inline constexpr vector pcg_uvec1(vector x) noexcept return x; } +/// @private template constexpr vector pcg_uvec2(vector x) noexcept { @@ -139,6 +141,7 @@ constexpr vector pcg_uvec2(vector x) noexcept return x; } +/// @private template constexpr vector pcg_uvec3(vector x) noexcept { @@ -162,6 +165,7 @@ constexpr vector pcg_uvec3(vector x) noexcept return x; } +/// @private template constexpr vector pcg_uvec4(vector x) noexcept { @@ -188,10 +192,8 @@ constexpr vector pcg_uvec4(vector x) noexcept return x; } -/// @} - /** - * PCG hash functions. + * PCG hash function. * * @param x Input value. *