Skip to content

Commit a06c2da

Browse files
committed
Remove unnecessary call to clamp function
1 parent 540b6fc commit a06c2da

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

AudioFile.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,7 +1394,7 @@ T AudioSampleConverter<T>::thirtyTwoBitIntToSample (int32_t sample)
13941394
else if (std::numeric_limits<T>::is_integer)
13951395
{
13961396
if constexpr (std::is_signed_v<T>)
1397-
return static_cast<T> (clamp (sample, -2147483648, 2147483647));
1397+
return static_cast<T> (sample);
13981398
else
13991399
return static_cast<T> (clamp (static_cast<T> (sample + 2147483648), 0, 4294967295));
14001400
}
@@ -1407,8 +1407,8 @@ int32_t AudioSampleConverter<T>::sampleToThirtyTwoBitInt (T sample)
14071407
if constexpr (std::is_floating_point<T>::value)
14081408
{
14091409
// multiplying a float by a the max int32_t is problematic because
1410-
// of roundng errors which can cause wrong errors to come out, so
1411-
// we use a different
1410+
// of roundng errors which can cause wrong values to come out, so
1411+
// we use a different implementation here compared to other types
14121412
if constexpr (std::is_same_v<T, float>)
14131413
{
14141414
if (sample >= 1.f)

0 commit comments

Comments
 (0)