@@ -90,7 +90,7 @@ namespace hlsl
90
90
}
91
91
92
92
// arithmetic operators
93
- this_t operator+(const emulated_float64_t rhs) NBL_CONST_MEMBER_FUNC
93
+ this_t operator+(const this_t rhs) NBL_CONST_MEMBER_FUNC
94
94
{
95
95
if (FlushDenormToZero)
96
96
{
@@ -150,6 +150,9 @@ namespace hlsl
150
150
uint64_t resultMantissa;
151
151
if (lhsSign != rhsSign)
152
152
{
153
+ if ((data | ieee754::traits<float64_t>::signMask) == (rhs.data | ieee754::traits<float64_t>::signMask))
154
+ return _static_cast<this_t>(0ull);
155
+
153
156
uint64_t rhsNormMantissaHigh = shiftAmount >= 64 ? 0ull : rhsNormMantissa >> shiftAmount;
154
157
uint64_t rhsNormMantissaLow = 0ull;
155
158
if (shiftAmount < 128 )
@@ -197,25 +200,25 @@ namespace hlsl
197
200
return bit_cast<this_t>(0xdeadbeefbadcaffeull);
198
201
}
199
202
200
- emulated_float64_t operator+(float rhs)
203
+ this_t operator+(float rhs)
201
204
{
202
205
return bit_cast<this_t>(data) + create (rhs);
203
206
}
204
207
205
- emulated_float64_t operator-(emulated_float64_t rhs) NBL_CONST_MEMBER_FUNC
208
+ this_t operator-(this_t rhs) NBL_CONST_MEMBER_FUNC
206
209
{
207
- emulated_float64_t lhs = bit_cast<this_t>(data);
208
- emulated_float64_t rhsFlipped = rhs.flipSign ();
210
+ this_t lhs = bit_cast<this_t>(data);
211
+ this_t rhsFlipped = rhs.flipSign ();
209
212
210
213
return lhs + rhsFlipped;
211
214
}
212
215
213
- emulated_float64_t operator-(float rhs) NBL_CONST_MEMBER_FUNC
216
+ this_t operator-(float rhs) NBL_CONST_MEMBER_FUNC
214
217
{
215
218
return bit_cast<this_t>(data) - create (rhs);
216
219
}
217
220
218
- emulated_float64_t operator*(emulated_float64_t rhs) NBL_CONST_MEMBER_FUNC
221
+ this_t operator*(this_t rhs) NBL_CONST_MEMBER_FUNC
219
222
{
220
223
if (FlushDenormToZero)
221
224
{
@@ -233,7 +236,7 @@ namespace hlsl
233
236
if (emulated_float64_t_impl::isZero (data) || emulated_float64_t_impl::isZero (rhs.data))
234
237
return bit_cast<this_t>(sign);
235
238
236
- emulated_float64_t retval = this_t::create (0ull);
239
+ this_t retval = this_t::create (0ull);
237
240
238
241
int lhsBiasedExp = ieee754::extractBiasedExponent (data);
239
242
int rhsBiasedExp = ieee754::extractBiasedExponent (rhs.data);
@@ -269,12 +272,12 @@ namespace hlsl
269
272
}
270
273
}
271
274
272
- emulated_float64_t operator*(float rhs)
275
+ this_t operator*(float rhs)
273
276
{
274
277
return bit_cast<this_t>(data) * create (rhs);
275
278
}
276
279
277
- emulated_float64_t operator/(const emulated_float64_t rhs) NBL_CONST_MEMBER_FUNC
280
+ this_t operator/(const this_t rhs) NBL_CONST_MEMBER_FUNC
278
281
{
279
282
if (FlushDenormToZero)
280
283
{
@@ -332,7 +335,7 @@ namespace hlsl
332
335
}
333
336
}
334
337
335
- emulated_float64_t operator/(const float rhs) NBL_CONST_MEMBER_FUNC
338
+ this_t operator/(const float rhs) NBL_CONST_MEMBER_FUNC
336
339
{
337
340
return bit_cast<this_t>(data) / create (rhs);
338
341
}
@@ -350,37 +353,37 @@ namespace hlsl
350
353
351
354
return data == rhs.data;
352
355
}
353
- bool operator!=(emulated_float64_t rhs) NBL_CONST_MEMBER_FUNC
356
+ bool operator!=(this_t rhs) NBL_CONST_MEMBER_FUNC
354
357
{
355
358
if (!FastMath && (hlsl::isnan<uint64_t>(data) || hlsl::isnan<uint64_t>(rhs.data)))
356
359
return false ;
357
360
358
361
return !(bit_cast<this_t>(data) == rhs);
359
362
}
360
- bool operator<(emulated_float64_t rhs) NBL_CONST_MEMBER_FUNC
363
+ bool operator<(this_t rhs) NBL_CONST_MEMBER_FUNC
361
364
{
362
365
return emulated_float64_t_impl::operatorLessAndGreaterCommonImplementation<FastMath, hlsl::less <uint64_t> >(data, rhs.data);
363
366
}
364
- bool operator>(emulated_float64_t rhs) NBL_CONST_MEMBER_FUNC
367
+ bool operator>(this_t rhs) NBL_CONST_MEMBER_FUNC
365
368
{
366
369
return emulated_float64_t_impl::operatorLessAndGreaterCommonImplementation<FastMath, hlsl::greater <uint64_t> >(data, rhs.data);
367
370
}
368
- bool operator<=(emulated_float64_t rhs) NBL_CONST_MEMBER_FUNC
371
+ bool operator<=(this_t rhs) NBL_CONST_MEMBER_FUNC
369
372
{
370
373
if (!FastMath && (hlsl::isnan<uint64_t>(data) || hlsl::isnan<uint64_t>(rhs.data)))
371
374
return false ;
372
375
373
376
return !(bit_cast<this_t>(data) > bit_cast<this_t>(rhs.data));
374
377
}
375
- bool operator>=(emulated_float64_t rhs)
378
+ bool operator>=(this_t rhs)
376
379
{
377
380
if (!FastMath && (hlsl::isnan<uint64_t>(data) || hlsl::isnan<uint64_t>(rhs.data)))
378
381
return false ;
379
382
380
383
return !(bit_cast<this_t>(data) < bit_cast<this_t>(rhs.data));
381
384
}
382
385
383
- emulated_float64_t flipSign ()
386
+ this_t flipSign ()
384
387
{
385
388
return bit_cast<this_t>(data ^ ieee754::traits<float64_t>::signMask);
386
389
}
0 commit comments