I'm using Visual Studio 2013 + CTP.
I have defined the following function:
constexpr DWORD const_getHash(const char *str, DWORD curHash = 0) {
return !*str ? curHash : const_getHash(str + 1,
(curHash >> 13 | curHash << (32 - 13)) + (*str >= 'a' ? *str - 32 : *str));
}
which I use like this:
DWORD hash = const_getHash("ok");
The compiler doesn't issue any warnings but by looking at the "disassembly" I can tell that const_getHash() is executed at runtime.
What's wrong?
Aucun commentaire:
Enregistrer un commentaire