http://qs321.pair.com?node_id=1226623


in reply to Re^7: Faster Luhn Check Digit Calculation?
in thread Faster Luhn Check Digit Calculation?

Update:Ignore this! It doesn't stand up to syphilis's scrutiny. (It only works for the OPs limited test range by luck!)

Looks fat to me ( just kidding :)

If its skinny you want, try this for (its lack of) size :)

Correct results and 35% faster to boot:

int lookup[] = { 8, 6, 4, 2, 0, 7, 5, 3, 1, 9, 7, 5, 3, 1, 9, 6, 4, 2, + 0 }; int c_fluhn( int n ) { return lookup[ n % 20 ]; }

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". The enemy of (IT) success is complexity.
In the absence of evidence, opinion is indistinguishable from prejudice. Suck that fhit