Created
December 19, 2023 01:23
-
-
Save navono/4ca0e38008dd7b6d1a5aa9e7a9564858 to your computer and use it in GitHub Desktop.
hash string then can use it in switch statement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
constexpr unsigned int hash(const char* s, int off = 0) { | |
return !s[off] ? 5381 : (hash(s, off + 1) * 33) ^ s[off]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment