5 ms·
The intro sentence, "At a fundamental level, a programmer needs to manipulate bits," gave me a strange moment of mental dissonance. It just highlights to me ho
by interroboink 3y ago
The intro sentence, "At a fundamental level, a programmer needs to manipulate bits," gave me a strange moment of mental dissonance.
It just highlights to me how the job of "programmer" can be many things, depending on your domain. One could argue that a goal of programming is to build higher abstractions so you don't need to manipulate bits in order to express yourself.
But that aside, I enjoy this stuff, so here are some links for others interested:
* A neat SO post about implementing "popcount" using SWAR trickery: https://stackoverflow.com/questions/109023/count-the-number-of-set-bits-in-a-32-bit-integer/109025#109025 https://stackoverflow.com/questions/109023/count-the-number-...
* Good collections of bit hacks:
** https://graphics.stanford.edu/~seander/bithacks.html https://graphics.stanford.edu/~seander/bithacks.html (also mentioned in the article's comments)
** http://aggregate.org/MAGIC/ http://aggregate.org/MAGIC/
- kodah 3y ago> It just highlights to me how the job of "programmer" can be many things, depending on your domain. Agreed, though I'd argue different languages entreat different kinds of knowledge. That's why there's value in having experience in many. > One could argue that a goal of programming is to build higher abstractions so you don't need to manipulate bits in order to express yourself. Could be; though I'd argue just because those abstractions are there, it's still good to know how and why they work. That reveals some things about the language which I think influences the subtle choices you make every day.
- bitshiftfaced 3y agoI think it depends on how you interpret "fundamental level." It sounds like you're more interpreting it in the sense of "what are the basic important things that a programmer needs to build on." But then I think there's an interpretation that also makes perfect sense: bits are the fundamental building blocks of which the programmer can manipulate.
- interroboink 3y agoYes, I suppose it's a hardware/software divide, largely. Bits are how things are implemented in hardware typically, and programs need to run on hardware, so bits are relevant. But from a pure software POV, it shouldn't matter if it's bits or ternary[1] or something else; the software's purpose is to accomplish some higher-level task. [1]https://en.wikipedia.org/wiki/Ternary_computer https://en.wikipedia.org/wiki/Ternary_computer