Skip to content

Commit 4f0255a

Browse files
committed
Use in-house float inf constant to avoid clang warnings
1 parent d6f26d0 commit 4f0255a

File tree

4 files changed

+25
-23
lines changed

4 files changed

+25
-23
lines changed

include/FastNoise/Generators/Cellular.inl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class FastSIMD::DispatchClass<FastNoise::CellularValue, SIMD> final : public vir
2323
std::array<int32v, kMaxDistanceCount> valueHash;
2424
std::array<float32v, kMaxDistanceCount> distance;
2525

26-
distance.fill( float32v( INFINITY ) );
26+
distance.fill( float32v( kInfinity ) );
2727

2828
this->ScalePositions( x, y );
2929

@@ -88,7 +88,7 @@ class FastSIMD::DispatchClass<FastNoise::CellularValue, SIMD> final : public vir
8888
std::array<int32v, kMaxDistanceCount> valueHash;
8989
std::array<float32v, kMaxDistanceCount> distance;
9090

91-
distance.fill( float32v( INFINITY ) );
91+
distance.fill( float32v( kInfinity ) );
9292

9393
this->ScalePositions( x, y, z );
9494

@@ -165,7 +165,7 @@ class FastSIMD::DispatchClass<FastNoise::CellularValue, SIMD> final : public vir
165165
std::array<int32v, kMaxDistanceCount> valueHash;
166166
std::array<float32v, kMaxDistanceCount> distance;
167167

168-
distance.fill( float32v( INFINITY ) );
168+
distance.fill( float32v( kInfinity ) );
169169

170170
this->ScalePositions( x, y, z, w );
171171

@@ -257,7 +257,7 @@ class FastSIMD::DispatchClass<FastNoise::CellularDistance, SIMD> final : public
257257
float32v jitter = float32v( this->kJitter2D ) * this->GetSourceValue( mJitterModifier, seed, x, y );
258258

259259
std::array<float32v, kMaxDistanceCount> distance;
260-
distance.fill( float32v( INFINITY ) );
260+
distance.fill( float32v( kInfinity ) );
261261

262262
this->ScalePositions( x, y );
263263

@@ -309,7 +309,7 @@ class FastSIMD::DispatchClass<FastNoise::CellularDistance, SIMD> final : public
309309
float32v jitter = float32v( this->kJitter3D ) * this->GetSourceValue( mJitterModifier, seed, x, y, z );
310310

311311
std::array<float32v, kMaxDistanceCount> distance;
312-
distance.fill( float32v( INFINITY ) );
312+
distance.fill( float32v( kInfinity ) );
313313

314314
this->ScalePositions( x, y, z );
315315

@@ -374,7 +374,7 @@ class FastSIMD::DispatchClass<FastNoise::CellularDistance, SIMD> final : public
374374
float32v jitter = float32v( this->kJitter4D ) * this->GetSourceValue( mJitterModifier, seed, x, y, z, w );
375375

376376
std::array<float32v, kMaxDistanceCount> distance;
377-
distance.fill( float32v( INFINITY ) );
377+
distance.fill( float32v( kInfinity ) );
378378

379379
this->ScalePositions( x, y, z, w );
380380

include/FastNoise/Generators/Generator.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,12 @@ namespace FastNoise
7272
"Gradient Outer Product",
7373
};
7474

75+
static constexpr float kInfinity = (float)(1e+300 * 1e+300);
76+
7577
struct OutputMinMax
7678
{
77-
float min = INFINITY;
78-
float max = -INFINITY;
79+
float min = kInfinity;
80+
float max = -kInfinity;
7981

8082
OutputMinMax& operator <<( float v )
8183
{

include/FastNoise/Generators/Generator.inl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ public:
7979
FastNoise::OutputMinMax GenUniformGrid2D( float* noiseOut, int xStart, int yStart, int xSize, int ySize, int seed ) const final
8080
{
8181
ScopeExitx86ZeroUpper zeroUpper;
82-
float32v min( INFINITY );
83-
float32v max( -INFINITY );
82+
float32v min( kInfinity );
83+
float32v max( -kInfinity );
8484

8585
int32v xIdx( xStart );
8686
int32v yIdx( yStart );
@@ -125,8 +125,8 @@ public:
125125
FastNoise::OutputMinMax GenUniformGrid3D( float* noiseOut, int xStart, int yStart, int zStart, int xSize, int ySize, int zSize, int seed ) const final
126126
{
127127
ScopeExitx86ZeroUpper zeroUpper;
128-
float32v min( INFINITY );
129-
float32v max( -INFINITY );
128+
float32v min( kInfinity );
129+
float32v max( -kInfinity );
130130

131131
int32v xIdx( xStart );
132132
int32v yIdx( yStart );
@@ -178,8 +178,8 @@ public:
178178
FastNoise::OutputMinMax GenUniformGrid4D( float* noiseOut, int xStart, int yStart, int zStart, int wStart, int xSize, int ySize, int zSize, int wSize, int seed ) const final
179179
{
180180
ScopeExitx86ZeroUpper zeroUpper;
181-
float32v min( INFINITY );
182-
float32v max( -INFINITY );
181+
float32v min( kInfinity );
182+
float32v max( -kInfinity );
183183

184184
int32v xIdx( xStart );
185185
int32v yIdx( yStart );
@@ -238,8 +238,8 @@ public:
238238
FastNoise::OutputMinMax GenPositionArray2D( float* noiseOut, int count, const float* xPosArray, const float* yPosArray, float xOffset, float yOffset, int seed ) const final
239239
{
240240
ScopeExitx86ZeroUpper zeroUpper;
241-
float32v min( INFINITY );
242-
float32v max( -INFINITY );
241+
float32v min( kInfinity );
242+
float32v max( -kInfinity );
243243

244244
intptr_t index = 0;
245245
while( index < count - (intptr_t)int32v::ElementCount )
@@ -268,8 +268,8 @@ public:
268268
FastNoise::OutputMinMax GenPositionArray3D( float* noiseOut, int count, const float* xPosArray, const float* yPosArray, const float* zPosArray, float xOffset, float yOffset, float zOffset, int seed ) const final
269269
{
270270
ScopeExitx86ZeroUpper zeroUpper;
271-
float32v min( INFINITY );
272-
float32v max( -INFINITY );
271+
float32v min( kInfinity );
272+
float32v max( -kInfinity );
273273

274274
intptr_t index = 0;
275275
while( index < count - (intptr_t)int32v::ElementCount )
@@ -300,8 +300,8 @@ public:
300300
FastNoise::OutputMinMax GenPositionArray4D( float* noiseOut, int count, const float* xPosArray, const float* yPosArray, const float* zPosArray, const float* wPosArray, float xOffset, float yOffset, float zOffset, float wOffset, int seed ) const final
301301
{
302302
ScopeExitx86ZeroUpper zeroUpper;
303-
float32v min( INFINITY );
304-
float32v max( -INFINITY );
303+
float32v min( kInfinity );
304+
float32v max( -kInfinity );
305305

306306
intptr_t index = 0;
307307
while( index < count - (intptr_t)int32v::ElementCount )
@@ -352,8 +352,8 @@ public:
352352
FastNoise::OutputMinMax GenTileable2D( float* noiseOut, int xSize, int ySize, int seed ) const final
353353
{
354354
ScopeExitx86ZeroUpper zeroUpper;
355-
float32v min( INFINITY );
356-
float32v max( -INFINITY );
355+
float32v min( kInfinity );
356+
float32v max( -kInfinity );
357357

358358
int32v xIdx( 0 );
359359
int32v yIdx( 0 );

include/FastNoise/Generators/Utils.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ namespace FastNoise
990990
{
991991
float32v invSqrt = FS::InvSqrt( sqrDist );
992992

993-
return FS::Masked( invSqrt != float32v( INFINITY ), sqrDist * invSqrt );
993+
return FS::Masked( invSqrt != float32v( kInfinity ), sqrDist * invSqrt );
994994
}
995995
else
996996
{

0 commit comments

Comments
 (0)