#### Archived

This topic is now archived and is closed to further replies.

# bit shifting and isometrics engines..

This topic is 6972 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Bitshifting only applies if the tile x and y offsets are a multiple of 2 (like a 64x31 tile).

##### Share on other sites
Dragon,

Can you explain to me a bit how this works?

##### Share on other sites
a bit shift once to the left is equal to muliplying by 2, only faster. so if you bit shift 4 to the left, it's *2*2*2*2, or, *16. In other words, 4 << 3 = 4*2*2*2 = 32

Thanks guys.

##### Share on other sites
I'm trying to remember where I read this and how it is applied.

When trying to calculate the position offset for blitting tiles, someone suggested bitshifting the values because they're faster than multiplies. I can neither remember who wrote this, or what it was about. Anyone remember which of the original Iso tutorials/articles this was from and what it was about?

##### Share on other sites
You can also bit shift and add the values to come up with others, for instance, to multiply a number by 320:
newvalue = (val << 8) + (val << 6);

1. 1
Rutin
26
2. 2
3. 3
4. 4
5. 5

• 9
• 13
• 19
• 14
• 9
• ### Forum Statistics

• Total Topics
632940
• Total Posts
3009329
• ### Who's Online (See full list)

There are no registered users currently online

×