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
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
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):
longis 32-bit, so pm_long islong 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
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
builtin sum() over floats (CPython >= 3.12)
| Name | What it does |
|---|---|
add | |
value |
Fields
hidoublelodouble
void add(double x)
No comment.
double value() const
No comment.
class PySet
CPython set emulator. Keys must be unique per value (ints, or interned ids).
| Name | What it does |
|---|---|
PySet | |
clear | |
size | |
add | |
add | adds an integer key (the key is its own hash) |
contains | |
contains | true if the integer key is in the set (the key is its own hash) |
discard | |
discard | removes an integer key (the key is its own hash) |
merge | set_merge (s |= other, set(other), s.update(other)) |
for_each | |
items | |
intersection | set_intersection(a, b): new set |
Fields
tstd::vector< E >masksize_tfillint64_tusedint64_t
PySet()
No comment.
void clear()
No comment.
int64_t size() const
No comment.
void add(int64_t key, int64_t hash)
No comment.
void add(int64_t intkey)
adds an integer key (the key is its own hash)
bool contains(int64_t key, int64_t hash) const
No comment.
bool contains(int64_t intkey) const
true if the integer key is in the set (the key is its own hash)
void discard(int64_t key, int64_t hash)
No comment.
void discard(int64_t intkey)
removes an integer key (the key is its own hash)
void merge(const PySet &o)
set_merge (s |= other, set(other), s.update(other))
void for_each(F &&f) const
No comment.
std::vector< int64_t > items() const
No comment.
static PySet intersection(const PySet &a, const PySet &b)
set_intersection(a, b): new set
struct PySet::E
Fields
keyint64_thashint64_tstuint8_t — 0 empty, 1 active, 2 dummy
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.