Two arrays in a 'grid'?

If this is possible, I’d love to know how, it’d be a real lifesaver. I hope one of you clever midiboxers might be able to help!

I have an array of 8x16 1-bit flags stored as ints. For the purpose of clarity, I’ll scale down my example to 4x8

X-Axis[4] = {10001001,01110000,10000010,00001100}

or…

10001001

01110000

10000010

00001100

Now it’s easy to get the bits from the X axis and it allows me to iterate through the row quickly by reading the byte, bitshifting, then testing the carry bit, to test the bits one by one. Cool.

Is there an easy and fairly quick way to get a column out of the Y axis? Preferably without it doing stupid amounts of pointer math! :wink: Maybe for performance’s sake it would be best to keep two sets of the data?

I get a very strong feeling that I’m missing something  ;D

Hi stryd,

I’d use the MIOS_HLP_GetBitORMask().

Not sure though if there is a better solution and I guess you already know that function. :-\

Cheers,

Michael

Yeh I thought that might be the go… I guess I was hoping that C had some magic pill for me heheheh

Thanks for the advice mate!