LurchBrick
Member
G'day all,
I've just started dipping my toes into the world of bitwise operators. After reading the manual and looking at some old blog articles by Mike as well as other tutorials, I was wondering what the differences are between bitshifting (1 << 2) and OR ( | ) for setting a bit.
I've seen both ways utilised although bit shifting seems to be the most commonly used. Anyone care to explain why this would be the preferred method?
I've just started dipping my toes into the world of bitwise operators. After reading the manual and looking at some old blog articles by Mike as well as other tutorials, I was wondering what the differences are between bitshifting (1 << 2) and OR ( | ) for setting a bit.
I've seen both ways utilised although bit shifting seems to be the most commonly used. Anyone care to explain why this would be the preferred method?