Jump to content

Two arrays in a 'grid'?


stryd_one
 Share

Recommended Posts

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! ;) 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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...