File tree Expand file tree Collapse file tree 1 file changed +10
-12
lines changed
include/nbl/builtin/hlsl/cpp_compat/impl Expand file tree Collapse file tree 1 file changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -106,21 +106,20 @@ struct find_msb_helper<uint64_t>
106
106
static int32_t findMSB (NBL_CONST_REF_ARG (uint64_t) val)
107
107
{
108
108
#ifdef __HLSL_VERSION
109
- const uint32_t lowBits = uint32_t (val);
110
109
const uint32_t highBits = uint32_t (val >> 32 );
110
+ const int32_t highMsb = find_msb_helper<uint32_t>::findMSB (highBits);
111
111
112
- const int32_t lowMsb = find_msb_helper<uint32_t>::findMSB (lowBits);
113
- if (lowMsb == -1 )
112
+ if (highMsb == -1 )
114
113
{
115
- const uint32_t highBits = uint32_t (val >> 32 );
116
- const int32_t highMsb = find_msb_helper<uint32_t>::findMSB (highBits );
117
- if (highBits == -1 )
114
+ const uint32_t lowBits = uint32_t (val);
115
+ const int32_t lowMsb = find_msb_helper<uint32_t>::findMSB (lowBits );
116
+ if (lowMsb == -1 )
118
117
return -1 ;
119
- else
120
- return 32 + highMsb ;
118
+
119
+ return lowMsb ;
121
120
}
122
121
123
- return lowMsb ;
122
+ return highMsb + 32 ;
124
123
#else
125
124
return glm::findMSB (val);
126
125
#endif
@@ -221,14 +220,13 @@ struct find_lsb_helper<uint64_t>
221
220
{
222
221
#ifdef __HLSL_VERSION
223
222
const uint32_t lowBits = uint32_t (val);
224
- const uint32_t highBits = uint32_t (val >> 32 );
225
-
226
223
const int32_t lowLsb = find_lsb_helper<uint32_t>::findLSB (lowBits);
224
+
227
225
if (lowLsb == -1 )
228
226
{
229
227
const uint32_t highBits = uint32_t (val >> 32 );
230
228
const int32_t highLsb = find_lsb_helper<uint32_t>::findLSB (highBits);
231
- if (highBits == -1 )
229
+ if (highLsb == -1 )
232
230
return -1 ;
233
231
else
234
232
return 32 + highLsb;
You can’t perform that action at this time.
0 commit comments