-
Notifications
You must be signed in to change notification settings - Fork 97
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
Timo's Motoko wishlist #3175
Labels
Comments
Now that we have inlining of prim wrappers (or I guess once we have that, not sure what the status is), maybe we can promise that two conversions via |
mergify bot
pushed a commit
that referenced
this issue
Jun 21, 2022
Introduce two new primitives {`shiftLeft`, `shiftRight`}, both with signature `(Nat, Nat32) -> Nat`. This is hopefully helpful for #3175. ------- - [x] `grep` for "TODO: use shift right instead" - [x] `grep` for "TODO: use shift left instead" - [ ] QuickChecks (but the tests are rather exhaustive already) - [x] make the prims into calls? — 1672aa0 ---------- ## Further optimisation opportunities - restructure the `lsh` code to reuse the 64-bit shift result to create the bignum ([see comment below](#3112 (comment))) - `clz >= 33` as a criterion for compact
mergify bot
pushed a commit
that referenced
this issue
Aug 11, 2023
…4139) Add type conversions between `Nat`s of adjacent sizes. Similarly for `Int`s. Namely: - `Nat8` <--> `Nat16` - `Nat16` <--> `Nat32` - `Nat32` <--> `Nat64` - `Int8` <--> `Int16` - `Int16` <--> `Int32` - `Int32` <--> `Int64` DX feature requested by Zhenya Usenko in the motoko working group and Timo: partially #3175
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NatX
/IntX
but missing forNat
/Int
) — See Shift primitives forNat
#3112NatX
/IntX
or at least between adjacent pairs of types (e.g.Nat8
<->Nat16
etc).NatX
-> Blob operations, for easy access to bytes in little-endian and perhaps big-endian encoding.Blob
value (blob[n]
orBlob.sub(blob, n)
)Stabilization
(emission) #3149)@timohanke
The text was updated successfully, but these errors were encountered: