| Line |
Branch |
Exec |
Source |
| 1 |
|
|
#include "stats/StatisticsUtilities.hpp" |
| 2 |
|
|
|
| 3 |
|
|
#include <cstddef> |
| 4 |
|
|
#include <cstdint> |
| 5 |
|
|
#include <cstring> |
| 6 |
|
|
|
| 7 |
|
|
namespace // unnamed namspace |
| 8 |
|
|
{ |
| 9 |
|
|
|
| 10 |
|
|
// Make a special value that shows as FEFEFEFE in a debugger hex dump. |
| 11 |
|
|
// The value is chosen specifically NOT to fall in the NaN space, so equality |
| 12 |
|
|
// comparisons work as expected. |
| 13 |
|
2 |
float make_fefefefe() |
| 14 |
|
|
{ |
| 15 |
|
2 |
std::uint32_t bits = 0xFEFEFEFE; |
| 16 |
|
|
float fefefefe; |
| 17 |
|
2 |
memcpy(&fefefefe, &bits, sizeof(fefefefe)); |
| 18 |
|
2 |
return fefefefe; |
| 19 |
|
|
} |
| 20 |
|
|
const float kUndefined(make_fefefefe()); |
| 21 |
|
|
|
| 22 |
|
|
} // unnamed namespace |
| 23 |
|
|
|
| 24 |
|
|
namespace stats |
| 25 |
|
|
{ |
| 26 |
|
|
|
| 27 |
|
34 |
const float& undefined() |
| 28 |
|
|
{ |
| 29 |
|
34 |
return kUndefined; |
| 30 |
|
|
} |
| 31 |
|
|
|
| 32 |
|
17 |
bool undefined(const float& value) |
| 33 |
|
|
{ |
| 34 |
|
17 |
return value == kUndefined; |
| 35 |
|
|
} |
| 36 |
|
|
|
| 37 |
|
|
} // namespace stats |
| 38 |
|
|
|