Skip to main content

Utilities

Deadlines, move helpers, portability and the Python bridge. Generated from the comments in the headers by Doxygen and tools/gen_cpp_reference.py; public members only.

deadline.hpp​

csrc/deadline.hpp

move_util.hpp​

csrc/move_util.hpp

File-local helpers shared by uniqueness.cpp, als.cpp and set_logic.cpp (split from extra.cpp): move descriptors, eliminations, and a set that keeps an elimination list from being reported twice.

Internal linkage: each file that includes this header gets its own copy.

portable.hpp​

csrc/portable.hpp

Portability shims.

With GCC / Clang on Linux and macOS nothing changes: the compiler builtins are used directly and pm_long is plain long (64-bit there), so those builds compile to the same code as the reference build.

  • Windows (MSVC and clang-cl): long is 32-bit, so pm_long is long long (the engine assumes a 64-bit long).
  • MSVC proper: no __builtin_popcount / ctz / clz; mapped to portable code and _BitScan* intrinsics.

Fields

  • pm_long = long

pycompat.hpp​

csrc/pycompat.hpp

Bit-exact emulation of the bits of CPython 3.14 the reference solver's behaviour depends on:

  • set iteration order (setobject.c: linear probing + perturbation, resize policy, merge / intersection construction order),
  • tuple hashing (xxHash-style tuplehash, used for set-of-tuples order),
  • builtin sum() over floats (Neumaier compensated summation, 3.12+),
  • float ** float special cases. Only what the solver needs: keys are non-negative ints (hash == value) or interned tuple ids carrying a precomputed hash.

struct CompSum​

source

builtin sum() over floats (CPython >= 3.12)

NameWhat it does
add
value

Fields

  • hi double
  • lo double

void add(double x)​

source

No comment.

double value() const​

source

No comment.

class PySet​

source

CPython set emulator. Keys must be unique per value (ints, or interned ids).

NameWhat it does
PySet
clear
size
add
addadds an integer key (the key is its own hash)
contains
containstrue if the integer key is in the set (the key is its own hash)
discard
discardremoves an integer key (the key is its own hash)
mergeset_merge (s |= other, set(other), s.update(other))
for_each
items
intersectionset_intersection(a, b): new set

Fields

  • t std::vector< E >
  • mask size_t
  • fill int64_t
  • used int64_t

PySet()​

source

No comment.

void clear()​

source

No comment.

int64_t size() const​

source

No comment.

void add(int64_t key, int64_t hash)​

source

No comment.

void add(int64_t intkey)​

source

adds an integer key (the key is its own hash)

bool contains(int64_t key, int64_t hash) const​

source

No comment.

bool contains(int64_t intkey) const​

source

true if the integer key is in the set (the key is its own hash)

void discard(int64_t key, int64_t hash)​

source

No comment.

void discard(int64_t intkey)​

source

removes an integer key (the key is its own hash)

void merge(const PySet &o)​

source

set_merge (s |= other, set(other), s.update(other))

void for_each(F &&f) const​

source

No comment.

std::vector< int64_t > items() const​

source

No comment.

static PySet intersection(const PySet &a, const PySet &b)​

source

set_intersection(a, b): new set

struct PySet::E​

source

Fields

  • key int64_t
  • hash int64_t
  • st uint8_t — 0 empty, 1 active, 2 dummy

solver_util.hpp​

csrc/solver_util.hpp

File-local helpers shared by the solver's source files (solver.cpp, direct_view.cpp, notes_view.cpp, nary_moves.cpp): k-combinations, innie / outie region records, move descriptors, eliminations.

Internal linkage: each file that includes this header gets its own copy.