jasmin icon indicating copy to clipboard operation
jasmin copied to clipboard

add something to exit while and for loop

Open bgregoir opened this issue 1 year ago • 2 comments

this kind of code are tricking to translate in jasmin:

  k = 0;
    for (i = 0; i < K; ++i) {
        for (j = 0; j < N; ++j) {
            h->vec[i].coeffs[j] = 0;
        }

        if (sig[OMEGA + i] < k || sig[OMEGA + i] > OMEGA) {
            return 1;
        }

        for (j = k; j < sig[OMEGA + i]; ++j) {
            /* Coefficients are ordered for strong unforgeability */
            if (j > k && sig[j] <= sig[j - 1]) {
                return 1;
            }
            h->vec[i].coeffs[sig[j]] = 1;
        }

        k = sig[OMEGA + i];
    }

    /* Extra indices are zero for strong unforgeability */
    for (j = k; j < OMEGA; ++j) {
        if (sig[j]) {
            return 1;
        }
    }

I think being able to exit loop early will help.

bgregoir avatar Jun 16 '24 06:06 bgregoir

If I understand correctly, what you would like to have is a break keyword ?

MrDaiki avatar Sep 25 '24 15:09 MrDaiki

Yes

eponier avatar Sep 27 '24 06:09 eponier