fork download
unsigned reverse(unsigned int h)
{
	bitset<32> hash;
	// 1. hash = hash + (hash << 16);
	for(int i = 0; i < 32; i += 16)
		h = h - ((h & (((1LL << 16) - 1) << i)) << 16);
	// 2. hash = hash ^ (hash >> 11);
	hash = h;
	for(int i = 20; i >= 0; i--)
		hash[i] = hash[i] ^ hash[i + 11];
	h = hash.to_ulong();
	// 3. hash = hash + (hash << 3);
	for(int i = 0; i < 32; i += 3)
		h = h - ((h & (((1LL << 3) - 1) << i)) << 3);
	// 4. hash = hash ^ (hash >> 6);
	hash = h;
	for(int i = 25; i >= 0; i--)
		hash[i] = hash[i] ^ hash[i + 6];
	h = hash.to_ulong();
	// 5. hash = hash + (hash << 10);
	for(int i = 0; i < 32; i += 10)
		h = h - ((h & (((1LL << 10) - 1) << i)) << 10);
	return h;
}
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'unsigned int reverse(unsigned int)':
prog.cpp:3:2: error: 'bitset' was not declared in this scope
  bitset<32> hash;
  ^
prog.cpp:3:13: error: 'hash' was not declared in this scope
  bitset<32> hash;
             ^
stdout
Standard output is empty