MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
OrderKey.hpp File Reference

Doubles as 64-bit keys whose unsigned order is their numeric order. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  MayaFlux
 Main namespace for the Maya Flux audio engine.
namespace  MayaFlux::Kinesis
namespace  MayaFlux::Kinesis::Discrete
namespace  MayaFlux::Kinesis::Discrete::detail

Functions

constexpr double MayaFlux::Kinesis::Discrete::from_order_key (uint64_t key) noexcept
 The value of an order key.
constexpr uint64_t MayaFlux::Kinesis::Discrete::order_key (double value) noexcept
 The order key of a value.
void MayaFlux::Kinesis::Discrete::order_keys (std::span< const double > values, std::span< uint64_t > keys) noexcept
 Writes the order key of every value, stopping at the shorter span.

Variables

constexpr uint64_t MayaFlux::Kinesis::Discrete::detail::order_nan_key = ~uint64_t { 0 }
constexpr uint64_t MayaFlux::Kinesis::Discrete::detail::order_sign_bit = uint64_t { 1 } << 63U

Detailed Description

Doubles as 64-bit keys whose unsigned order is their numeric order.

A key is stored as two 32-bit words, low word first, which is the byte layout of a little-endian uint64_t and of a uvec2 (x low, y high). Comparing high words and then low words as unsigned integers orders doubles exactly, with no fp64 arithmetic. -0.0 and +0.0 share one key and every NaN maps to the largest key, so NaN sorts last.

Definition in file OrderKey.hpp.