Skip to content

Commit b38a68a

Browse files
committed
ScaledDataConversion : Fix warning 4244 ( possible loss of data in conversion )
- The constructor for `half` only takes a `float` value, causing an implicit cast and warning 4244 when casting a `double` to `half`. Since this function is only being called for `unsigned` types, we can safely replace `std::numeric_limits::min` with 0.
1 parent f6fc459 commit b38a68a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/IECore/ScaledDataConversion.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ struct ScaledDataConversion<
163163
T operator()( F f ) const
164164
{
165165
BOOST_STATIC_ASSERT( boost::is_unsigned< T >::value );
166-
f = std::max<F>( f, (F)(std::numeric_limits<T>::min() ) );
166+
f = std::max<F>( f, (F)( 0.0 ) );
167167
f = std::min<F>( f, (F)( 1.0 ) );
168168
float result = static_cast<float>(f) * std::numeric_limits<T>::max();
169169
return static_cast<T>( round( result ) );

0 commit comments

Comments
 (0)