[go-nuts] math type algo question and Go's int size

2018-04-08 Thread Darko Luketic
Yeah I'm not a math wiz and the older I get the harder I find maths. But sometimes you can't evade maths in programming. So here's my question for math wizards. Essentially, I'm trying to write an url shortener. And I found this package I agree with (don't re-invent the wheel) https://github.com/n

Re: [go-nuts] math type algo question and Go's int size

2018-04-08 Thread Dan Kortschak
For 64 bit word size: https://stackoverflow.com/questions/11376288/fast -computing-of-log2-for-64-bit-integers/11398748#11398748 This can be derived from examples in https://graphics.stanford.edu/~sea nder/bithacks.html which gives the 32 bit version. However, the math/bits package gives you Len,