This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
finding_20the_20modulus_20of_20part_20of_20an_20array [2018/04/17 16:13] tbest3112 Added syntax highlighting |
finding_20the_20modulus_20of_20part_20of_20an_20array [2021/12/04 17:14] richardrussell Modified for 64-bit compatibility |
||
---|---|---|---|
Line 12: | Line 12: | ||
<code bb4w> | <code bb4w> | ||
DEF FN_ModPartialArray(d(), first%, last%) | DEF FN_ModPartialArray(d(), first%, last%) | ||
- | LOCAL I% | + | LOCAL i%% |
- | I% = ^d(first%)-5 | + | i%% = ^d(first%)-5 |
- | LOCAL ?I%, I%!1, a() | + | LOCAL ?i%%, i%%!1, a() |
- | ?I% = 1 : I%!1 = last%-first%+1 | + | ?i%% = 1 : i%%!1 = last%-first%+1 |
- | !^a() = I% | + | PTR(a()) = i%% |
= MOD(a()) | = MOD(a()) | ||
</code> | </code> | ||
Line 22: | Line 22: | ||
<code bb4w> | <code bb4w> | ||
DEF FN_ModPartialArray(d(), first%, last%) | DEF FN_ModPartialArray(d(), first%, last%) | ||
- | LOCAL I% | + | LOCAL i%% |
- | I% = ^d(first%)-5 | + | i%% = ^d(first%)-5 |
- | LOCAL ?I%, I%!1, a() | + | LOCAL ?i%%, i%%!1, a() |
ON ERROR LOCAL RESTORE LOCAL : ERROR ERR, REPORT$ | ON ERROR LOCAL RESTORE LOCAL : ERROR ERR, REPORT$ | ||
- | ?I% = 1 : I%!1 = last%-first%+1 | + | ?i%% = 1 : i%%!1 = last%-first%+1 |
- | !^a() = I% | + | PTR(a()) = i%% |
= MOD(a()) | = MOD(a()) | ||
</code> | </code> |