

Bit Level Manipulation - mburst
http://maxburstein.com/blog/bit-level-manipulation/

======
ColinWright
Serious question: How many people here on HN find things at this level useful?
I'm always intrigued to find out how many working programmers don't know this
sort of thing.

I might start a poll on it ...

~~~
huhtenberg
It's truly depressing to see this submission sitting at 20+ upvotes, on HN of
all places.

~~~
mburst
Just because you know something doesn't mean everyone else does. This is one
of those mentalities that prevents people from asking questions and learning
new things. You're sitting in a classroom and the professor goes over a
challenging topic but you look around and it seems everyone else understands
it. So to save yourself from looking stupid you don't ask a question.

If you've had a formal education in programming then you've probably at least
heard of bitwise operators. If not then I could definitely see these things
not coming up. Either way I find compiler optimizations neat so I figured I'd
make a post and share about some of the basic ones.

~~~
huhtenberg
As I said, it's depressing to see this sort of topic being of an interest to a
wider HN audience. It's not the topic that's bad, it's the audience
composition that's disappointing.

------
jared314
I have always wondered why I was taught binary as if they were arrays, but
programming languages never allowed me to use bits like arrays. It's always
masking and shifting uint16_t or int32_t, instead of what I really want,

"result = bits[3] xor bits2[3]".

~~~
jonsen
I'm unable to find a reference, but I'm pretty sure you could do that in PL/I.

------
simarpreet007
It's never bad to post something that might seem very trivial at first. I
learnt the trick of checking an odd or even with this post. Thanks OP!

