Hackers Delight! http://www.amazon.com/Hackers-Delight-Edition-Henry-Warren/d...
Discovered my library allows me read it for free online:
http://proquestcombo.safaribooksonline.com/9780133084993
Others can at least see the table of contents.
51–60 of 82 posts
Hackers Delight! http://www.amazon.com/Hackers-Delight-Edition-Henry-Warren/d...
Discovered my library allows me read it for free online:
http://proquestcombo.safaribooksonline.com/9780133084993
Others can at least see the table of contents.
On top of it, it doesn't have many advantages. It takes much less memory, but takes more lines to write, while on the hardware, it's the opposite: more memory, not so fast processors.
What always bugged me, is that there are no real programming facilities to take advantages of bits, like encoding many variable in on 32 bit integer variable.
I guess
So, if even the people who are aspiring to write "code to the metal" console games don't know binary then, I imagine, a generic programmer knows it even less.
Earlier quoted context omitted.
yes, but we don't care. A language is agnostic of the underlying system. Even the C standard is built on top of a machine that doesn't really exist. Anyhow, the point is, limitations of the underlying system aren't excuses for why this syntax isn't implemented. If I can write bitmasks, then so can a compiler, right?
There are tons of useful features that aren't supported in C. The basic feature set of C was determined by whatever operations Dennis Ritchie could easily implement on the PDP-11 when he created the earliest C compilers. (Fun fact: the bitwise operators even preceded the Boolean operators like && and ||.) If the question is "why isn't bit indexing supported" then "because processors didn't (and don't) support it" is…
I use them a lot when I'm designing hardware, but I never use them when I'm doing "regular programming", there's no reason to do it if I can use more readable, higher level constructs.
When writing network protocols or de-marshalling binary data it's common to want to know which bits are set in a byte. You might do a & 4 == 4 to test the 3rd bit is set, how would you do this with 'regular programming'?
I come from full time 8/16 bit assembly (Z80 and later 68000) so I tend to use those naturally. Very powerful and fun; it's a shame most universities don't teach the basics; it saves a lot of CPU cycles.
As I get older (lets just say I'm over 35), I'm baffled by older programmers who worry about this stuff. When you were a young programmer, there were likely problems that were solved that you never had to deal with that older programmers feel were super important. Bitwise operations likely stick around for the duration of digital computing, but I think it's foolhardy to think that the vast majority of developers will need to know about them in all their gory detail.
New developers will stand on the shoulders of giants so to speak, and solve the problems that are pertinent to their domain. It may or may not include bit-wise operations.
Where Extra = { Radio = 1, PowerWindows = 2, Tint = 4, Rims = 8 };
Then I can do: if (Tint | powerWindows) { return totalPrice + 1000; }