Skip to content

Instantly share code, notes, and snippets.

@julian-klode
Created May 7, 2025 18:43
Show Gist options
  • Save julian-klode/ffff99c2eda077348267f52d195bc1a6 to your computer and use it in GitHub Desktop.
Save julian-klode/ffff99c2eda077348267f52d195bc1a6 to your computer and use it in GitHub Desktop.
#include <cstdint>
#include <tuple>
struct priority {
uint16_t padding;
uint16_t dynamic;
uint16_t staticp;
uint16_t index;
bool operator<(const priority &other) const;
private:
uint64_t tie() const
{
return uint64_t(index) << 48 | uint64_t(staticp) << 32 | uint64_t(dynamic) << 16 | uint64_t(padding);
}
};
bool priority::operator<(const priority &other) const
{
return tie() < other.tie();
// return std::tie(index, staticp, dynamic, padding) < std::tie(other.index, other.staticp, other.dynamic, other.padding);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment