??? 06/13/07 20:23 Modified: 06/13/07 20:32 Read: times |
#140710 - 47, 48, 49 Responding to: ???'s previous message |
Your buffers are declared 48 bytes long, that's indices 0 to 47. So, using compare value 49, the index value would go up to 48, hence both buffers would "overflow".
But, for real world example, I struggled with the following one today in C (and I have already written it in 2 different asms without thinking a minute): Let's have a bunch of 4-byte variables (say unsigned longs (UL), all global); but they are not arranged as an array (they are constituents of various structures). We need a function, with two arguments - an another 4-byte variable (UL), and an "index" - which would add the first parameter to a selection of the said variables, subtract from another set, and increment/decrement some more of them. The index determines which selection would we use. For example, we have variables V1, V2, ... V5. When called with index=1, we would like to add the value to V1 and V2, subtract it from V3 and increment V4. With index=2, we would like to add the value to V2, subtract from V1 and increment V5. With index=3, we would like to add the value to V4 only. JW |