4 ms·
I would suggest Hacker's Delight too; the Chapter 2, Basics, is freely available at the website [1]. Pretty sure that the linked algorithm is also there (don't
by lifthrasiir 10y ago
I would suggest Hacker's Delight too; the Chapter 2, Basics, is freely available at the website [1]. Pretty sure that the linked algorithm is also there (don't have a copy right now so can't check).
[1] http://hackersdelight.org/ http://hackersdelight.org/
- b3h3moth 10y agoI would suggest a great resource about that: http://chessprogramming.wikispaces.com/Bit-Twiddling http://chessprogramming.wikispaces.com/Bit-Twiddling
- pkaye 10y agoI have that book. Pretty good. If you want to save some money, buy the DRM free PDF copy on informit.com but wait for one of their 40-50% off sales which happen near major holiday. I don't see one for July 4th though.
- zimmerfrei 10y agoThese hacks have actually been modeled and generalized into a mathematical construct called Mixed Boolean Arithmetic [1][2]. With a few matrix operations, you can actually generate an arbitrary number of hacky-looking (or obfuscated, as that was the actual intention of the authors of [1]) expressions from any initial, simple expression. [1] http://link.springer.com/chapter/10.1007/978-3-540-77535-5_5 http://link.springer.com/chapter/10.1007/978-3-540-77535-5_5 (and I deeply apologize I can't find the free PDF version, though sci-hub may help here) [2] http://blog.quarkslab.com/what-theoretical-tools-are-needed-to-simplify-mba-expressions.html http://blog.quarkslab.com/what-theoretical-tools-are-needed-...
- nick_name 10y ago>> and I deeply apologize I can't find the free PDF version, though sci-hub may help here) https://sci-hub.cc/10.1007/978-3-540-77535-5_5 https://sci-hub.cc/10.1007/978-3-540-77535-5_5
- 0xmohit 10y agoUse https://sci-hub.ac/10.1007/978-3-540-77535-5_5 https://sci-hub.ac/10.1007/978-3-540-77535-5_5 in order to prevent browsers complaining about certificate mismatch.
- angersock 10y agoSeconding the Hacker's Delight book. I think you'll probably enjoy it more if you do low-level programming, but there's a lot of cool mind-expanding stuff in there--the treatment of Hilbert Curves is quite fun.
- jhallenworld 10y agoMy favorite is the elementary x&-x (isolate least significant set bit). This is basically a priority arbiter using the carry chain, and in hardware (HDL), since the carry chain is already heavily optimized, is faster than priority arbiters using basic gates. Next favorite is "compress selected bits", because I figured out the inverse, which Henry Warren then published as "expand" in the 2nd edition: http://www.hackersdelight.org/hdcodetxt/expand.c.txt http://www.hackersdelight.org/hdcodetxt/expand.c.txt
- tedmiston 10y agoCoincidently Hacker's Delight 2e is available on Safari Books Online for any other fellow subscribers. https://www.safaribooksonline.com/library/view/hackers-delight-second/9780133084993/ https://www.safaribooksonline.com/library/view/hackers-delig...