Live data from Hacker News

Absolute Beginner's Guide to Bit Shifting

stackoverflow.com

21–23 of 23 posts

Re: Absolute Beginner's Guide to Bit Shifting

#21

Beyond OS kernels , drivers and embedded systems is there any real use for this? I only ask because we were never taught about bit shifting at university and I can't think of a time where it would have ever been useful in my work but despite this it seems to be a very common thing to ask about at interviews so I have sort of educated myself about it for that reason alone.

> Beyond OS kernels , drivers and embedded systems is there any real use for this?

If you're parsing a binary format you'll probably use bit shifting.

Bit shifting is just bitwise arithmetic. Assuming you did CS or a related degree, it's more likely you forgot about being taught about it. In fact it'd pretty hard to come up with a CS syllabus that does not mention bitwise arithmetic.

These are some subjects where bitwise arithmetic is bound to appear: Intro to Programming, Data Structures, Operating Systems, Computer Architecture/Organization, Graphics, Cryptography, Implementation of Programming Languages.

Re: Absolute Beginner's Guide to Bit Shifting

#22

Beyond OS kernels , drivers and embedded systems is there any real use for this? I only ask because we were never taught about bit shifting at university and I can't think of a time where it would have ever been useful in my work but despite this it seems to be a very common thing to ask about at interviews so I have sort of educated myself about it for that reason alone.

> we were never taught about bit shifting at university

This is surprising to me. I'm taking a computer architecture course now and it's the third class that bitwise operations have been mentioned and in the greatest detail (exactly how it's implemented in hardware). In fact, I think it was first mentioned in my intro to CS course, which used C++ (more like C with streams, but whatever).

Is it a CS program or something like CIS?

Re: Absolute Beginner's Guide to Bit Shifting

#23

Beyond OS kernels , drivers and embedded systems is there any real use for this? I only ask because we were never taught about bit shifting at university and I can't think of a time where it would have ever been useful in my work but despite this it seems to be a very common thing to ask about at interviews so I have sort of educated myself about it for that reason alone.

> we were never taught about bit shifting at university This is surprising to me. I'm taking a computer architecture course now and it's the third class that bitwise operations have been mentioned and in the greatest detail (exactly how it's implemented in hardware). In fact, I think it was first mentioned in my intro to CS course, which used C++ (more like C with streams, but whatever). Is it a CS program or somethi…

CS courses tend to explain what bit shifting is but not when you would use it.

For example you'll often see a lecturer drawing lots of 1s and 0s on a whiteboard to illustrate it but you're less likely to see a simple example Java program which uses shifting to get RGB values deconstructed.

Post reply on HN