0xPolygonMiden / miden-vm

STARK-based virtual machine
MIT License
612 stars 150 forks source link

Add an inverse of u32split instruction #1329

Open hackaugusto opened 2 months ago

hackaugusto commented 2 months ago

At the time we only a instruction to split a felt into two u32 called u32split, but we don't have the reverse operation to join two u32 to form a felt.

hackaugusto commented 2 months ago

The instruction could be something like:

u32assert2 mul.4294967296 add

edit: actually, now that I think of it, the code above is not always correct, having the value 2**32 - 1 twice in the stack would pass the above check, but the addition would not fit in a felt. more thought needs to be put into the validation