MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / normalize

Function normalize

extlibs/fmt/include/fmt/format-inl.h:424–437  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

422
423// Normalizes the value converted from double and multiplied by (1 << SHIFT).
424template <int SHIFT> fp normalize(fp value) {
425 // Handle subnormals.
426 const auto shifted_implicit_bit = fp::implicit_bit << SHIFT;
427 while ((value.f & shifted_implicit_bit) == 0) {
428 value.f <<= 1;
429 --value.e;
430 }
431 // Subtract 1 to account for hidden bit.
432 const auto offset =
433 fp::significand_size - fp::double_significand_size - SHIFT - 1;
434 value.f <<= offset;
435 value.e -= offset;
436 return value;
437}
438
439inline bool operator==(fp x, fp y) { return x.f == y.f && x.e == y.e; }
440

Callers 1

format_floatFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected