G
Guest
I have a loop which iterates over an array in a particular order:
for (j = 0; j < 16; j++) T[(4 - j) % 4] = ...;
The loop proceeds normally for j = 0 through j = 4, but gives an
IndexOutOfRangeException at j = 5. Playing with the watch window seems to
indicate that the modulo is being completely ignored:
j = 0x5 (int)
T[(4 - j) % 4] = error: index '4-j%4' out of bound for pointer/array 'T'
(4 - j) % 4 = 0xffffffff (int)
4 - j = 0xffffffff (int)
0xffffffff % 4 = 0x3 (long)
I'm stumped. Any ideas?
for (j = 0; j < 16; j++) T[(4 - j) % 4] = ...;
The loop proceeds normally for j = 0 through j = 4, but gives an
IndexOutOfRangeException at j = 5. Playing with the watch window seems to
indicate that the modulo is being completely ignored:
j = 0x5 (int)
T[(4 - j) % 4] = error: index '4-j%4' out of bound for pointer/array 'T'
(4 - j) % 4 = 0xffffffff (int)
4 - j = 0xffffffff (int)
0xffffffff % 4 = 0x3 (long)
I'm stumped. Any ideas?