HigherOrderCO/Bend

Add native casting operations

developedby opened this issue · 0 comments

Is your feature request related to a problem? Please describe.
HVM exposes to_f24, to_u24 and to_i24 primitive operations, but they're not exposed in Bend.

Describe the solution you'd like

Add a Cast { op: CastOp, val: Term } term and some cast syntax. The options I thought of are:

  • to_f24(expr)
  • f24(expr)
  • expr as f24

We should keep in mind the future possibility of adding a bit reinterpret operation (eg. to_f24 to cast and as_f24 to reinterpret bits).