Skip to content

Commit 42baa6c

Browse files
author
kevyuu
committed
Change NBL_CONSTEXPR_STATIC_FUNC to NBL_CONSTEXPR_STATIC
1 parent 07f7a4a commit 42baa6c

File tree

1 file changed

+33
-15
lines changed

1 file changed

+33
-15
lines changed

include/nbl/builtin/hlsl/emulated/int64_t.hlsl

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct emulated_int64_base
4343
*
4444
* @param [in] _data Vector of `uint32_t` encoding the `uint64_t/int64_t` being emulated. Stored as little endian (first component are the lower 32 bits)
4545
*/
46-
NBL_CONSTEXPR_STATIC_FUNC this_t create(NBL_CONST_REF_ARG(storage_t) _data)
46+
NBL_CONSTEXPR_STATIC this_t create(NBL_CONST_REF_ARG(storage_t) _data)
4747
{
4848
this_t retVal;
4949
retVal.data = _data;
@@ -56,7 +56,7 @@ struct emulated_int64_base
5656
* @param [in] lo Lowest 32 bits of the `uint64_t/int64_t` being emulated
5757
* @param [in] hi Highest 32 bits of the `uint64_t/int64_t` being emulated
5858
*/
59-
NBL_CONSTEXPR_STATIC_FUNC this_t create(NBL_CONST_REF_ARG(uint32_t) lo, NBL_CONST_REF_ARG(uint32_t) hi)
59+
NBL_CONSTEXPR_STATIC this_t create(NBL_CONST_REF_ARG(uint32_t) lo, NBL_CONST_REF_ARG(uint32_t) hi)
6060
{
6161
return create(storage_t(lo, hi));
6262
}
@@ -114,6 +114,24 @@ struct emulated_int64_base
114114
constexpr inline this_t operator<<(uint32_t bits) const;
115115
constexpr inline this_t operator>>(uint32_t bits) const;
116116

117+
constexpr inline this_t& operator&=(const this_t& val)
118+
{
119+
data &= val.data;
120+
return *this;
121+
}
122+
123+
constexpr inline this_t& operator|=(const this_t& val)
124+
{
125+
data |= val.data;
126+
return *this;
127+
}
128+
129+
constexpr inline this_t& operator^=(const this_t& val)
130+
{
131+
data ^= val.data;
132+
return *this;
133+
}
134+
117135
#endif
118136

119137
// ------------------------------------------------------- ARITHMETIC OPERATORS -------------------------------------------------
@@ -191,7 +209,7 @@ struct static_cast_helper<emulated_int64_base<Signed>, emulated_int64_base<!Sign
191209
using To = emulated_int64_base<Signed>;
192210
using From = emulated_int64_base<!Signed>;
193211

194-
NBL_CONSTEXPR_STATIC_FUNC To cast(NBL_CONST_REF_ARG(From) other)
212+
NBL_CONSTEXPR_STATIC To cast(NBL_CONST_REF_ARG(From) other)
195213
{
196214
To retVal;
197215
retVal.data = other.data;
@@ -206,7 +224,7 @@ struct static_cast_helper<I, emulated_int64_base<Signed> NBL_PARTIAL_REQ_BOT(con
206224
using From = emulated_int64_base<Signed>;
207225

208226
// Return only the lowest bits
209-
NBL_CONSTEXPR_STATIC_FUNC To cast(NBL_CONST_REF_ARG(From) val)
227+
NBL_CONSTEXPR_STATIC To cast(NBL_CONST_REF_ARG(From) val)
210228
{
211229
return _static_cast<To>(val.data.x);
212230
}
@@ -218,7 +236,7 @@ struct static_cast_helper<I, emulated_int64_base<Signed> NBL_PARTIAL_REQ_BOT(con
218236
using To = I;
219237
using From = emulated_int64_base<Signed>;
220238

221-
NBL_CONSTEXPR_STATIC_FUNC To cast(NBL_CONST_REF_ARG(From) val)
239+
NBL_CONSTEXPR_STATIC To cast(NBL_CONST_REF_ARG(From) val)
222240
{
223241
return bit_cast<To>(val.data);
224242
}
@@ -231,7 +249,7 @@ struct static_cast_helper<emulated_int64_base<Signed>, I NBL_PARTIAL_REQ_BOT(con
231249
using From = I;
232250

233251
// Set only lower bits
234-
NBL_CONSTEXPR_STATIC_FUNC To cast(NBL_CONST_REF_ARG(From) i)
252+
NBL_CONSTEXPR_STATIC To cast(NBL_CONST_REF_ARG(From) i)
235253
{
236254
return To::create(_static_cast<uint32_t>(i), uint32_t(0));
237255
}
@@ -243,7 +261,7 @@ struct static_cast_helper<emulated_int64_base<Signed>, I NBL_PARTIAL_REQ_BOT(con
243261
using To = emulated_int64_base<Signed>;
244262
using From = I;
245263

246-
NBL_CONSTEXPR_STATIC_FUNC To cast(NBL_CONST_REF_ARG(From) i)
264+
NBL_CONSTEXPR_STATIC To cast(NBL_CONST_REF_ARG(From) i)
247265
{
248266
// `bit_cast` blocked by GLM vectors using a union
249267
#ifndef __HLSL_VERSION
@@ -417,13 +435,13 @@ struct minus<emulated_int64_base<Signed> >
417435
};
418436

419437
template<>
420-
NBL_CONSTEXPR_INLINE emulated_uint64_t plus<emulated_uint64_t>::identity = _static_cast<emulated_uint64_t>(uint64_t(0));
438+
NBL_CONSTEXPR emulated_uint64_t plus<emulated_uint64_t>::identity = _static_cast<emulated_uint64_t>(uint64_t(0));
421439
template<>
422-
NBL_CONSTEXPR_INLINE emulated_int64_t plus<emulated_int64_t>::identity = _static_cast<emulated_int64_t>(int64_t(0));
440+
NBL_CONSTEXPR emulated_int64_t plus<emulated_int64_t>::identity = _static_cast<emulated_int64_t>(int64_t(0));
423441
template<>
424-
NBL_CONSTEXPR_INLINE emulated_uint64_t minus<emulated_uint64_t>::identity = _static_cast<emulated_uint64_t>(uint64_t(0));
442+
NBL_CONSTEXPR emulated_uint64_t minus<emulated_uint64_t>::identity = _static_cast<emulated_uint64_t>(uint64_t(0));
425443
template<>
426-
NBL_CONSTEXPR_INLINE emulated_int64_t minus<emulated_int64_t>::identity = _static_cast<emulated_int64_t>(int64_t(0));
444+
NBL_CONSTEXPR emulated_int64_t minus<emulated_int64_t>::identity = _static_cast<emulated_int64_t>(int64_t(0));
427445

428446
// --------------------------------- Compound assignment operators ------------------------------------------
429447
// Specializations of the structs found in functional.hlsl
@@ -457,13 +475,13 @@ struct minus_assign<emulated_int64_base<Signed> >
457475
};
458476

459477
template<>
460-
NBL_CONSTEXPR_INLINE emulated_uint64_t plus_assign<emulated_uint64_t>::identity = plus<emulated_uint64_t>::identity;
478+
NBL_CONSTEXPR emulated_uint64_t plus_assign<emulated_uint64_t>::identity = plus<emulated_uint64_t>::identity;
461479
template<>
462-
NBL_CONSTEXPR_INLINE emulated_int64_t plus_assign<emulated_int64_t>::identity = plus<emulated_int64_t>::identity;
480+
NBL_CONSTEXPR emulated_int64_t plus_assign<emulated_int64_t>::identity = plus<emulated_int64_t>::identity;
463481
template<>
464-
NBL_CONSTEXPR_INLINE emulated_uint64_t minus_assign<emulated_uint64_t>::identity = minus<emulated_uint64_t>::identity;
482+
NBL_CONSTEXPR emulated_uint64_t minus_assign<emulated_uint64_t>::identity = minus<emulated_uint64_t>::identity;
465483
template<>
466-
NBL_CONSTEXPR_INLINE emulated_int64_t minus_assign<emulated_int64_t>::identity = minus<emulated_int64_t>::identity;
484+
NBL_CONSTEXPR emulated_int64_t minus_assign<emulated_int64_t>::identity = minus<emulated_int64_t>::identity;
467485

468486
// ------------------------------------------------ TYPE TRAITS SATISFIED -----------------------------------------------------
469487

0 commit comments

Comments
 (0)