[Nottingham] A Little Coding Gem

Martin martin at ml1.co.uk
Fri Nov 16 14:43:28 UTC 2012

On 16/11/12 13:08, Nick Leverton wrote:
> On Thu, Nov 15, 2012 at 06:08:24PM +0000, Martin wrote:
>> Folks,
>> Fortune has just served up a little beauty for me just now:
>> -- Yet another mystical 'C' gem. ...
>> Anyone like to guess or even work out what it does? :-> (Evil grin :-) )
> Far too lazy for the latter here, that would involve the sort of real
> work that I'm avoiding by reading the list :-)  I guessed some sort of
> CRC but I see others have given a more accurate answer.
>> More to the point, why would you want to do that?!
> To save space and/or time and/or registers and/or cache and/or brainpower
> (by monkey-copying soemone else's code), delete where not applicable ?

I'd say space and speed for a good cool geekie result.

Is there not something written in the "Real Programmers" text about
spending days crafting one small tight uber-geek routine to drive the
project manager to despair to then finish the other 95% of the project
in an all-nighter?... ;-)

> There are loads of techniques to achieve the sort of bit-twiddling
> where you (or at least I) sometimes think "how can I do that neatly"
> on Bithacks:
> http://graphics.stanford.edu/~seander/bithacks.html

I rather enjoyed the bit twiddling. Thanks for your link, that is rather
a good collection. One for a few beers! Our little example and variants
appears in:


> But on the rare occasions I need one, at least I comment where it came
> from and how it (allegedly) works !

Hey! The source was quoted: Fortune ;-)


OK... So I left off the description... :-o

Just one of those good fun random snippets :-)


- ------------------ - ----------------------------------------
-    Martin Lomas    - OpenPGP (GPG/PGP) Public Key: 0xCEE1D3B7
- martin @ ml1 co uk - Import from   hkp://subkeys.pgp.net   or
- ------------------ - http:// ml1 .co .uk/martin_ml1_co_uk.gpg

More information about the Nottingham mailing list