NethermindEth / cairo-vm-go

A virtual machine for Cairo written in Go
MIT License
79 stars 49 forks source link

feat: `SquashDictInnerContinueLoop` hint #406

Closed TAdev0 closed 3 months ago

TAdev0 commented 3 months ago

Resolves #299

This PR implements SquashDictInnerContinueLoop hint, which checks if the squashing loop should continue or not, depending on whether there are access indices remaining or not.

It writes 1 or 0 in should_continue field of loop_temps struct variable

Here is the LoopTemps struct :

   struct LoopTemps {
        index_delta_minus1: felt,
        index_delta: felt,
        ptr_delta: felt,
        should_continue: felt,
    }

I added offset of 4 to write on the 4th item of the struct, as we first store the number of items and then each item contiguously in memory

TAdev0 commented 3 months ago

@har777 comments addressed. Its nice to use the WriteToNthStructField wrapper, it reduces code size. thanks