From 1ec4b7b9a1337c1a16ef5af3e6cd1067f043fdfb Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 1 Jun 2015 18:45:47 +1000 Subject: [PATCH] noise: add constexpr to eval functions --- noise/basis/perlin.hpp | 2 +- noise/basis/perlin.ipp | 2 +- noise/basis/value.hpp | 2 +- noise/basis/value.ipp | 2 +- noise/basis/worley.hpp | 2 +- noise/basis/worley.ipp | 6 +++--- noise/fractal/fbm.hpp | 2 +- noise/fractal/fbm.ipp | 2 +- noise/fractal/hetero.hpp | 2 +- noise/fractal/hetero.ipp | 2 +- noise/fractal/hmf.hpp | 2 +- noise/fractal/hmf.ipp | 2 +- noise/fractal/rmf.hpp | 2 +- noise/fractal/rmf.ipp | 2 +- 14 files changed, 16 insertions(+), 16 deletions(-) diff --git a/noise/basis/perlin.hpp b/noise/basis/perlin.hpp index 2f15513c..e0baabdc 100644 --- a/noise/basis/perlin.hpp +++ b/noise/basis/perlin.hpp @@ -30,7 +30,7 @@ namespace util { namespace noise { namespace basis { perlin (); range bounds (void) const; - T operator() (point<2,T>) const; + constexpr T operator() (point<2,T>) const; seed_t seed; diff --git a/noise/basis/perlin.ipp b/noise/basis/perlin.ipp index 2e151847..7265cc1c 100644 --- a/noise/basis/perlin.ipp +++ b/noise/basis/perlin.ipp @@ -50,7 +50,7 @@ namespace util { namespace noise { namespace basis { //------------------------------------------------------------------------- template L> - T + constexpr T perlin::operator() (util::point<2,T> p) const { // extract integer and fractional parts. be careful to always round down diff --git a/noise/basis/value.hpp b/noise/basis/value.hpp index b7c4016e..b02a8297 100644 --- a/noise/basis/value.hpp +++ b/noise/basis/value.hpp @@ -30,7 +30,7 @@ namespace util { namespace noise { namespace basis { value (); range bounds (void) const; - T operator() (util::point<2,T>) const; + constexpr T operator() (util::point<2,T>) const; seed_t seed; diff --git a/noise/basis/value.ipp b/noise/basis/value.ipp index fbde6e5a..698b667e 100644 --- a/noise/basis/value.ipp +++ b/noise/basis/value.ipp @@ -47,7 +47,7 @@ namespace util { namespace noise { namespace basis { //------------------------------------------------------------------------- template L> - T + constexpr T value::operator() (util::point<2,T> p) const { // extract integer and fractional parts. be careful to always round down diff --git a/noise/basis/worley.hpp b/noise/basis/worley.hpp index 47755c70..add2a95f 100644 --- a/noise/basis/worley.hpp +++ b/noise/basis/worley.hpp @@ -29,7 +29,7 @@ namespace util { namespace noise { namespace basis { worley (); range bounds (void) const; - T operator() (util::point<2,T>) const; + constexpr T operator() (util::point<2,T>) const; seed_t seed; diff --git a/noise/basis/worley.ipp b/noise/basis/worley.ipp index f0969d9f..132fe8b2 100644 --- a/noise/basis/worley.ipp +++ b/noise/basis/worley.ipp @@ -50,7 +50,7 @@ namespace util { namespace noise { namespace basis { //------------------------------------------------------------------------- template - T + constexpr T worley::operator() (util::point<2,T> p) const { // extract integer and fractional parts. be careful to always round down @@ -61,8 +61,8 @@ namespace util { namespace noise { namespace basis { auto p_rem = abs (p - p_int).template as (); // setup an array of distances - static constexpr size_t RADIUS = 1; - static constexpr size_t COUNT = pow2 (RADIUS * 2 + 1); + constexpr size_t RADIUS = 1; + constexpr size_t COUNT = pow2 (RADIUS * 2 + 1); T distances[COUNT] = { std::numeric_limits::quiet_NaN () }; T *cursor = distances; diff --git a/noise/fractal/fbm.hpp b/noise/fractal/fbm.hpp index 5b2f337c..6c370e24 100644 --- a/noise/fractal/fbm.hpp +++ b/noise/fractal/fbm.hpp @@ -60,7 +60,7 @@ namespace util { namespace noise { namespace fractal { T gain; B basis; - T operator() (util::point<2,T>) const; + constexpr T operator() (util::point<2,T>) const; }; } } } diff --git a/noise/fractal/fbm.ipp b/noise/fractal/fbm.ipp index 474de734..8a81f3bd 100644 --- a/noise/fractal/fbm.ipp +++ b/noise/fractal/fbm.ipp @@ -58,7 +58,7 @@ namespace util { namespace noise { namespace fractal { //------------------------------------------------------------------------- template - T + constexpr T fbm::operator() (util::point<2,T> p) const { T total = 0; diff --git a/noise/fractal/hetero.hpp b/noise/fractal/hetero.hpp index d84914d8..bc238e89 100644 --- a/noise/fractal/hetero.hpp +++ b/noise/fractal/hetero.hpp @@ -44,7 +44,7 @@ namespace util { namespace noise { namespace fractal { B basis; - T operator() (util::point<2,T>) const; + constexpr T operator() (util::point<2,T>) const; }; } } } diff --git a/noise/fractal/hetero.ipp b/noise/fractal/hetero.ipp index 648f0c39..a0928de3 100644 --- a/noise/fractal/hetero.ipp +++ b/noise/fractal/hetero.ipp @@ -35,7 +35,7 @@ namespace util { namespace noise { namespace fractal { //------------------------------------------------------------------------- template - T + constexpr T hetero::operator() (util::point<2,T> p) const { T exponents[octaves]; diff --git a/noise/fractal/hmf.hpp b/noise/fractal/hmf.hpp index 06f482ce..1b627f41 100644 --- a/noise/fractal/hmf.hpp +++ b/noise/fractal/hmf.hpp @@ -44,7 +44,7 @@ namespace util { namespace noise { namespace fractal { B basis; - T operator() (util::point<2,T>) const; + constexpr T operator() (util::point<2,T>) const; }; } } } diff --git a/noise/fractal/hmf.ipp b/noise/fractal/hmf.ipp index 9b3d1219..3b623ea4 100644 --- a/noise/fractal/hmf.ipp +++ b/noise/fractal/hmf.ipp @@ -36,7 +36,7 @@ namespace util { namespace noise { namespace fractal { //------------------------------------------------------------------------- template - T + constexpr T hmf::operator() (util::point<2,T> p) const { T exponents[octaves]; diff --git a/noise/fractal/rmf.hpp b/noise/fractal/rmf.hpp index 7c3c6ab7..90c11d95 100644 --- a/noise/fractal/rmf.hpp +++ b/noise/fractal/rmf.hpp @@ -55,7 +55,7 @@ namespace util { namespace noise { namespace fractal { T gain; B basis; - T operator() (util::point<2,T>) const; + constexpr T operator() (util::point<2,T>) const; }; } } } diff --git a/noise/fractal/rmf.ipp b/noise/fractal/rmf.ipp index b15bccec..f8f1c87c 100644 --- a/noise/fractal/rmf.ipp +++ b/noise/fractal/rmf.ipp @@ -53,7 +53,7 @@ namespace util { namespace noise { namespace fractal { //------------------------------------------------------------------------- template - T + constexpr T rmf::operator() (util::point<2,T> p) const { const T offset = 1;