Repository navigation
Support wide integral duration scalars - #254
Open
trestoncuzzort wants to merge 1 commit into
Open
trestoncuzzort wants to merge 1 commit into
trestoncuzzort wants to merge 1 commit into
Conversation
Preserve the int overloads and accept integral scalars representable by tick_type for multiplication and division, including compound assignments. Keep raw scalar values distinct from int_adapter special values. Fixes boostorg#246. Generated-by: Codex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #246.
nanoseconds(10) * uint64_t(2793555578)currently produces-15014117180ticks instead of27935555780. All four scalar operators narrow throughint, including a second narrowing inint_adapter.Add constrained integral overloads for
*,/,*=, and/=, converting scalars totick_type. Keep the four existingintoverloads. The new overloads accept scalar values representable bytick_type; finite results must fit the duration representation and divisors must be nonzero.The corresponding adapter operations treat raw representation values as scalar integers, including values whose bit patterns represent infinity or NaN inside an adapter. They preserve the existing special-value sign rules and negative-
intbehavior for unsigned adapters.The new regression runs with microsecond and nanosecond configurations. It covers wide signed/unsigned scalars, compound-assignment results, special values, valid limit-value operations, and typed pointers to the existing
intmembers. The duration reference documents the wider scalar contract.Validation:
intcomparisons have identical results before and after.Implemented and tested with Codex assistance.