Feature/new tiered int - #11
Conversation
Switch to TieredInt<StartSize, tierMax...> with buffer and stream serialization, restore comparison operators and std traits, and update tests for the new encoding. Co-authored-by: Cursor <cursoragent@cursor.com>
Partial deserialization is no longer needed now that DeserializeFrom reads the full encoded value in one pass. Co-authored-by: Cursor <cursoragent@cursor.com>
Base cell width (1, 2, or 4 bytes) now drives minimum encoded size and tier multipliers, with compile-time validation and tests for StartSize 2 and 4. Co-authored-by: Cursor <cursoragent@cursor.com>
Select runtime storage from kMaxEncodable, enforce compile-time assignment bounds with if consteval, and fix test includes for libc++ Clang 20. Co-authored-by: Cursor <cursoragent@cursor.com>
Use StartSize * 2^(NumTiers-1) instead of a global StartSize*8 cap, enforce the 8-byte wire limit at compile time, and add size static_asserts for all test TieredInt aliases. Co-authored-by: Cursor <cursoragent@cursor.com>
Cover every tier boundary where serialized size increases, plus kUpper at kMaxWireBytes for T1–T6 via buffer and stream round-trips. Co-authored-by: Cursor <cursoragent@cursor.com>
Use TieredInt<std::uint16_t, ...> / std::int16_t instead of int StartSize, keep TieredIntFromStartSize aliases, and implement native signed LE encoding with tier-1 direct values and sign-bit negative overflow. Co-authored-by: Cursor <cursoragent@cursor.com>
Compare signed and unsigned inputs in separate branches using int64_t and uint64_t respectively, and add a compile-time T6 kUpper assignment test. Co-authored-by: Cursor <cursoragent@cursor.com>
Sign was incorrectly stored in the header MSB, colliding with large positive overflow headers; encode signed values via ZigZag and reuse the unsigned tier path. Co-authored-by: Cursor <cursoragent@cursor.com>
Split check_value by signedness before casting, require buffer length in Deserialize, and add signed 3/4-tier tests including extremes above 2^31. Co-authored-by: Cursor <cursoragent@cursor.com>
Add saturated single-cell mode when the first wire tier fills the header, use safe mixed signed/unsigned compare, propagate cxx_std_23 on the numeric target, and return FixedPoint::Cast by value. Co-authored-by: Cursor <cursoragent@cursor.com>
Provide a lazy input-iterator view for variable-length TieredInt wire data and throw on truncated deserialize instead of asserting at runtime. Co-authored-by: Cursor <cursoragent@cursor.com>
Drop the old Q-format API and AE_FIXED macros in favor of compile-time range mapping, integer-only runtime arithmetic, and numeric_traits support. Co-authored-by: Cursor <cursoragent@cursor.com>
Add BoundRatio for compile-time bound conversion, cross-type Cast, multiply/divide, and min/max/clamp helpers; default tests to MacPorts Clang 20. Co-authored-by: Cursor <cursoragent@cursor.com>
Max is now a required logical bound with compile-time kScaleExp selection; add/sub, cast, and div_to use shift-based integer arithmetic only. Co-authored-by: Cursor <cursoragent@cursor.com>
Exponential stores wire codes with compile-time magnitude tables; text_io adds to_chars/FromString for TieredInt, FixedPoint, and Exponential without runtime float. Co-authored-by: Cursor <cursoragent@cursor.com>
wire_traits and Serialize/Deserialize cover built-in integers, TieredInt, FixedPoint, and Exponential with short-buffer rejection via std::out_of_range. Co-authored-by: Cursor <cursoragent@cursor.com>
Introduce runtime_numeric_traits with opt-in float/double backend, default BoundaryCode to Wire kRawMax, split exponential wire IO from core headers, and extend wire/type-size tests. Co-authored-by: Cursor <cursoragent@cursor.com>
Require extension header space and compile-time boundary checks, remove saturated single-cell mode and start-size aliases, and add stack-buffer ostream printing for TieredInt and FixedPoint. Co-authored-by: Cursor <cursoragent@cursor.com>
Make ordinary numeric construction logical-valued and compile-time checked for constants, preventing silent runtime clamping through the normal constructor: - FixedPoint: consteval integral/floating constructors with compile-time range checks; explicit runtime APIs FromRuntimeInteger/Saturating/ TryFromRuntimeInteger for clamping or checked conversion. - Exponential: logical-value consteval constructors (integer range checked, float consteval-only), explicit FromCode/Code raw-code construction, value() accessor, and runtime conversion APIs. Wire IO deserializes via FromCode. - Add compile-fail tests verifying out-of-range constants and runtime float construction are rejected at compile time. Co-authored-by: Cursor <cursoragent@cursor.com>
PackedRing<T, StorageBytes> is a byte ring that stores serialized T values back to back, with no per-record length headers. It relies on T being self-delimiting on the wire: the bytes_read reported by Deserialize is enough to skip from one record to the next. - Index types (head/tail/used/count) use SmallestUIntForSize<StorageBytes> rather than std::size_t. - push evicts the oldest records until a value fits, or fails if the value alone exceeds capacity. Records may straddle the physical buffer end; reads reassemble them through a stack buffer before decoding. - Iterator yields decoded T values by value, never by reference. - FixedPoint serializes/skips its raw value and Exponential its code(), reusing the existing wire_traits, so the ring needs no per-type code. - Add wire_io SerializedSizeAt<T> to report a record's byte length. - Tests cover TieredInt/FixedPoint/Exponential payloads, eviction, wraparound, and the index type selection. Co-authored-by: Cursor <cursoragent@cursor.com>
Verify FixedPoint<TieredInt>, Exponential variants, and PackedRing composition through wire round-trips, ring behavior, and trait checks. Split Exponential-heavy tests into separate files to keep compile times practical; FutureCode Exponential tests use an explicit BoundaryCode because the default kRawMax would build an enormous magnitude table. Co-authored-by: Cursor <cursoragent@cursor.com>
Add fixed_math primitives and rewrite encode/decode to use arithmetic mapping with safe DefaultBoundaryCode, avoiding compile-time tables proportional to BoundaryCode. Update Exponential and composed tests for two-byte wire ranges. Co-authored-by: Cursor <cursoragent@cursor.com>
Replace hardcoded log/exp iteration counts and work types with ExponentialMathPolicy, fix encode rounding, and add policy and boundary tests. Co-authored-by: Cursor <cursoragent@cursor.com>
Clamp raw values in int64 space before rep cast, divide wide multiply products in the intermediate type, and strengthen policy boundary tests. Co-authored-by: Cursor <cursoragent@cursor.com>
- make integral FixedPoint operator+ consteval - remove GCC -Wtype-limits test warnings - verify GCC, Clang and MSVC builds
Co-authored-by: Cursor <cursoragent@cursor.com>
Use windows-latest, Visual Studio 18 2026 with -A x64, unified configure/build/test steps, and the same MSVC/MinGW environment setup as aether-client-cpp. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Merge remote README rewrite and document kMaxBoundaryCode default. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Anton, please re-review when you have a chance. I addressed the previous review comments and did an additional pass across the changed code, not only on the exact commented lines:
CI is green now. I also rewrote the README manually after the API/documentation changes:
Please take another look. |
|
@BartolomeyKant, please re-review when you have a chance. I addressed the latest comments and applied the same cleanup across analogous code:
Local checks passed with MacPorts Clang 20.1.8 and
GitHub Actions are green for |
BartolomeyKant
left a comment
There was a problem hiding this comment.
Reread previous comments. Do not rewrite code just to pretend something is changed.
@NikolayChirkov your AI start hallucinating, validate what you're pushing.
C++23 if consteval discarded the runtime branch; with is_constant_evaluated both branches are ODR-used, so provide a non-constexpr definition that still fails constant evaluation. Co-authored-by: Cursor <cursoragent@cursor.com>
Share common uint64 helpers in integer_math.h and add direct boundary, exhaustive, and coverage tests for the new arithmetic paths. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Prove TieredInt<uint8_t,250,1514,1049834> matches historical packet/API size encoding byte-for-byte across the legacy domain. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@BartolomeyKant I re-validated every open review thread against the current HEAD Verified now:
I also called out the two remaining style nuances rather than claiming they were changed: the internal helper |
Restructure DeserializeUnsignedMagnitude if-constexpr/else so MSVC /WX no longer sees unreachable fallback code, and add minimal ValueType addition with range checks for tele arithmetic call sites.
BartolomeyKant
left a comment
There was a problem hiding this comment.
Issues in aether-tele should be fixed in this repository
Co-authored-by: Cursor <cursoragent@cursor.com>
No description provided.