Skip to content

Commit f334f90

Browse files
committed
ieee754::flipSign update, flipSign_helper::FloatingPoint fix
1 parent 7f1cb7d commit f334f90

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/nbl/builtin/hlsl/ieee754.hlsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ struct flipSign_helper<FloatingPoint, Bool NBL_PARTIAL_REQ_BOT(concepts::Floatin
159159
const AsUint asUint = ieee754::impl::bitCastToUintType(val);
160160
// can't use mix_helper because circular dep
161161
#ifdef __HLSL_VERSION
162-
return bit_cast<FloatingPoint>(asUint ^ spirv::select(AsUint(0ull), ieee754::traits<AsFloat>::signMask, flip));
162+
return bit_cast<FloatingPoint>(asUint ^ spirv::select(flip, ieee754::traits<AsFloat>::signMask, AsUint(0ull)));
163163
#else
164164
return bit_cast<FloatingPoint>(asUint ^ (flip ? ieee754::traits<AsFloat>::signMask : AsUint(0ull)));
165165
#endif
@@ -205,8 +205,8 @@ struct flipSign_helper<Vectorial, BoolVector NBL_PARTIAL_REQ_BOT(concepts::Float
205205
};
206206
}
207207

208-
template <typename T, typename U>
209-
NBL_CONSTEXPR_INLINE_FUNC T flipSign(T val, U flip)
208+
template <typename T, typename U = bool>
209+
NBL_CONSTEXPR_INLINE_FUNC T flipSign(T val, U flip = true)
210210
{
211211
return impl::flipSign_helper<T, U>::__call(val, flip);
212212
}

0 commit comments

Comments
 (0)