Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support U64 #162

Merged
merged 5 commits into from
Nov 4, 2022
Merged

Support U64 #162

merged 5 commits into from
Nov 4, 2022

Conversation

porcuquine
Copy link
Collaborator

@porcuquine porcuquine commented Nov 3, 2022

This PR adds support for fixed-width (64-bit) unsigned integers. With an eye to potential future work, it defines a general UInt enum, of which UInt::U64 is the only initial variant.

Arithmetic behaves as though mod 2^64. Division is 'integer division'.

Literal U64s are denoted with a suffix, either u64 or U64 directly following a valid number. It is a reader/parser error to specify a U64 from a number greater than the maximum U64.

The num operator coerces U64 to Num, with no loss of precision.

The u64 operator coerces Num to U64, preserving only the least-significant 8 bytes.

Arithmetic operations that mix U64 and Num yield Nums and are performed by first coercing the U64 to Num.

The u64 suffix cannot be combined with negative or fractional notation.

@porcuquine porcuquine merged commit 6f35090 into master Nov 4, 2022
@porcuquine porcuquine deleted the u64 branch November 4, 2022 16:28
@porcuquine porcuquine mentioned this pull request Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants