// Your First C++ Program
#include <iostream>
constexpr unsigned int hash(const char *str) {
unsigned int hash = 5381;
int c = 0;
while ((c = *str++)) {
hash = ((hash << 5) + hash) + c; // hash * 33 + c
}
return hash;
}
int main() {
const char *str = "Inventory::getItem";
int a = 5381;
for (int c = *str; c; c=*++str) {
a = (((a << 5)+a)+c);
}
std::cout << a << std::endl;
std::cout << hash("Level::hitResult");
return 0;
}
Ly8gWW91ciBGaXJzdCBDKysgUHJvZ3JhbQoKI2luY2x1ZGUgPGlvc3RyZWFtPgoKY29uc3RleHByIHVuc2lnbmVkIGludCBoYXNoKGNvbnN0IGNoYXIgKnN0cikgewogICAgdW5zaWduZWQgaW50IGhhc2ggPSA1MzgxOwogICAgaW50IGMgPSAwOwoKCgogICAgd2hpbGUgKChjID0gKnN0cisrKSkgewogICAgICAgIGhhc2ggPSAoKGhhc2ggPDwgNSkgKyBoYXNoKSArIGM7IC8vIGhhc2ggKiAzMyArIGMKICAgIH0KCiAgICByZXR1cm4gaGFzaDsKfQoKaW50IG1haW4oKSB7CgoJY29uc3QgY2hhciAqc3RyID0gIkludmVudG9yeTo6Z2V0SXRlbSI7CglpbnQgYSA9IDUzODE7CgkKCWZvciAoaW50IGMgPSAqc3RyOyBjOyBjPSorK3N0cikgewoJCWEgPSAoKChhIDw8IDUpK2EpK2MpOwoJfQoJCiAgICBzdGQ6OmNvdXQgPDwgYSA8PCBzdGQ6OmVuZGw7CgogICAgc3RkOjpjb3V0IDw8IGhhc2goIkxldmVsOjpoaXRSZXN1bHQiKTsKICAgIHJldHVybiAwOwp9