You're viewing a comment by Gregor and its responses.

Gregor Permalink
October 20, 2010, 18:13

I'm a web developer in PHP and JavaScript and only recently have I become interested in bitwise operations. I don't really have a need for them, but I'd like to know more about them. #1 I can see a use-case for - of course I sometimes want to know if integers are odd or even - but the rest of them I can't see why you would ever want/need to do this.

Can someone please provide some examples of why you would want to do things to the nth bit? I don't see what this actually achieves.

Comment Responses

YA mark Permalink
October 21, 2010, 13:47

How about making an amber and green LED alternately flash on your cool new widget you are building with a microcontroller?
Testing so a robotic control program will know that one of its sensors has tripped. (it has hit the wall, and maybe should reverse for a bit.)
This type of activity is usually reserved for hardware programming / embedded systems. It's what makes your keyboard work with a single chip and an embedded program to convert switch closures into a stream of characters the computer can use as input.

Gregor Permalink
October 21, 2010, 20:46

Thanks Mark. So I'm relatively safe in my ignorance of these then - until I start trying to install Linux on my toaster.

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "disk_143": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.