Clarification on magic numbers

Hello,

I`m interested maybe at some point implementing a hashing function, but before that I need to know the basics.

For example, http://en.wikipedia.org/wiki/De_Bruijn_sequence

Sadly, I don`t understand De Bruijn sequence. But even so, say these numbers aren`t related right?

1
2
3
4
5
6
7
8
9
10

unsigned int v;   
int r;           
static const int MultiplyDeBruijnBitPosition[32] = 
{
  0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 
  31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
};
r = MultiplyDeBruijnBitPosition[((uint32_t)((v & -v) * 0x077CB531U)) >> 27];



My question is what does the keywird static stand for, and why are these exact numbers chosen to do the multiplication ( Does it relate to magic square? )
The meaning of keyword static in C++ does depend on context.

C has a bit (but not much) less: http://en.cppreference.com/w/c/language/storage_duration
Topic archived. No new replies allowed.