Live data from Hacker News

Demystifying bitwise operations, a gentle C tutorial

andreinc.net

91–95 of 95 posts

Re: Demystifying bitwise operations, a gentle C tutorial

#91
post #36

Earlier quoted context omitted.

>Fundamental knowledge yes? no? hard to say The number of times I've needed this knowledge during all years of formal education and then years of work would be probably around 3. Then I started working with C and close to hardware and it became something that I need everyday. It's feels like bit proficiency is only useful in some very specific domains. Thought: is HTTP foundational knowledge nowadays? after all whole…

If you're a web developer and your product relies on HTTP, then HTTP is absolutely fundamental knowledge. Similarly, if you're a web developer and your language doesn't even have integers, then understanding twos compliment is probably not fundamental. That said, the people who proudly know the very least amount possible to perform their day job usually are not top performers.

Over years I've found that "top performer" is not purely about skill, often it is *just* about motivation, desire to move stuff ahead, to get things done, to improve current state of affair.

Like, rarely stuff is so hard that it requires some outstanding skills.

Re: Demystifying bitwise operations, a gentle C tutorial

#92
post #77
post #39

I'm trying to find some good resources or some book that covers modern C. For everything else from Python to Golangz Rust and everything in between - there are tons of quality books and even their own documentation in some cases is pretty decent. But not so with C. If you read this and have something, please share. Just C (not much interested in C++)

https://www.youtube.com/watch?v=QpAhX-gsHMs

Nice!

Re: Demystifying bitwise operations, a gentle C tutorial

#93
post #39

I'm trying to find some good resources or some book that covers modern C. For everything else from Python to Golangz Rust and everything in between - there are tons of quality books and even their own documentation in some cases is pretty decent. But not so with C. If you read this and have something, please share. Just C (not much interested in C++)

Just do a search on HN itself for "Modern C" and you will find a lot of discussions and recommendations.

That said, you can get started with any C book (The K&R Ansi C book is a good one to start with) since it is not a "huge" language and you can get to "newer" features incrementally.

Re: Demystifying bitwise operations, a gentle C tutorial

#94

A related puzzle: https://www.quaxio.com/know_your_bits/ More such puzzles: http://www.cs.cmu.edu/afs/cs/academic/class/15213-f02/www/L1... and http://csapp.cs.cmu.edu/public/datalab.pdf Bit Twiddling Hacks: http://graphics.stanford.edu/~seander/bithacks.html

For the first puzzle, code that determines if a value has one bit high, without any if/while/for, here's what I got: !(x & (x-1)) && x Was there a "best" solution somewhere? I couldnt get the code window to work.

-1 is not an allowed operator in my puzzle.

Re: Demystifying bitwise operations, a gentle C tutorial

#95
post #30
post #17

Earlier quoted context omitted.

> that may be confusing for all those x86 users out there. It’s pretty much every user these days - even most MIPS based network oriented devices run LE. BE lost many years ago.

The Network is big-endian (network byte order).

You are the one that brought up CPU architectures. Except for the now aging S390/z that will probably last in a few installations forever and the 5 people that pay to run POWER workstations the world is little endian.
Post reply on HN