If you are interested in such "tricks", you should check out the classic Hacker's Delight by Henry Warren