Add logic builtins to Julia and update type conversion prototypes#3238
Add logic builtins to Julia and update type conversion prototypes#3238
Conversation
docs/julia.rst
Outdated
| | gtu256(x:u256, y:u256) -> z:bool | true if x > y, false otherwise | | ||
| +---------------------------------------------------------------------------------------------------------------+ | ||
| | gtu256(x:u256, y:u256) -> z:bool | 1 if x > y, 0 otherwise | | ||
| | sltu256(x:s256, y:s256) -> z:bool | true if x < y, false otherwise, for signed numbers in two's complement | |
There was a problem hiding this comment.
Can you re-align the |? (it is fine to break the line, it will not result in an explicit line break in the rendered version.
There was a problem hiding this comment.
Not only that, some other parts are broken, wanted to finish that in this PR hence it is WIP.
docs/julia.rst
Outdated
| The following type conversion functions must be available: | ||
| - ``u32tobool(x:u32) -> y:bool`` | ||
| - ``booltou32(x:bool) -> y:u32`` | ||
| - ``u32tobool(x:u32) -> y:bool`` aka``y := not(iszerou256(x))`` |
There was a problem hiding this comment.
It has TBD below, need to be extended.
|
Agreed on today's meeting that a superset of all target-specific builtins will be defined here and supported by the analyser. That means helpers for |
| +---------------------------------------------------------------------------------------------------------------+ | ||
| | mulmodu256(x:u256, y:u256, m:u256) -> z:u256| (x * y) % m with arbitrary precision arithmetics | | ||
| +---------------------------------------------------------------------------------------------------------------+ | ||
| | ltu256(x:u256, y:u256) -> z:bool | 1 if x < y, 0 otherwise | |
There was a problem hiding this comment.
Should we be going for ltu256 or lt_u256?
There was a problem hiding this comment.
I think if we change it for lt, we have to change it for everything. I'm not really sure what the best option is, though ...
There was a problem hiding this comment.
We could also do "crazy" things like lt.u256
There was a problem hiding this comment.
I like lt.u256 for the looks, but it goes against the grammar we have.
There was a problem hiding this comment.
Also how do you feel about allowing # in identifiers in julia?
There was a problem hiding this comment.
I would actually prefer ..
There was a problem hiding this comment.
I thought we agreed on . already. # was in addition.
Part of #3226.