Store public selector offsets as int32
This commit is contained in:
1 parent
c8e49aead8
commit
24f28dd9c8
10 files changed
+247
-227
No files matched your search
+8
-9
@@ -35,15 +35,14 @@ them in place. `ConflictRange` returns owned `std::string`s because the decision
|
||||
procedure can synthesise endpoints (`keyAfter`, clamp bounds) that are not
|
||||
present in the input.
|
||||
|
||||
Caller-supplied selector offsets must fit in `std::int32_t`. Internally they are
|
||||
stored as `Int = std::int64_t`, because the closed form also builds derived
|
||||
selectors whose offsets (for example `end.offset - residualT`) need not fit in
|
||||
32 bits. All intermediate `Int` arithmetic assumes 64-bit signed integers do not
|
||||
overflow; with 32-bit input offsets and in-memory key counts that is far from
|
||||
the limit. The corpus parsers reject offsets outside the 32-bit input range, and
|
||||
both public `closedForm` entry points assert the same contract in debug builds.
|
||||
The assertion lives at the API boundary rather than in `Selector`, because
|
||||
derived selectors legitimately exceed the input range.
|
||||
Selector offsets are `std::int32_t`, matching the caller contract. The closed
|
||||
form converts the public `RangeRead` to `detail::RangeRead`, whose offsets are
|
||||
`Int = std::int64_t`, before deriving selectors (for example
|
||||
`end.offset - residualT`). All intermediate `Int` arithmetic assumes 64-bit
|
||||
signed integers do not overflow; with 32-bit input offsets and in-memory key
|
||||
counts that is far from the limit. The corpus parsers read offsets into a wider
|
||||
integer and reject values outside the 32-bit range before narrowing to
|
||||
`Selector`.
|
||||
|
||||
## Scope of the two implementations
|
||||
|
||||
|
||||
Reference in new issue
Block a user