Majoranapp
A C++ library for studying MZM in non-interacting systems
Misc.hpp
Go to the documentation of this file.
1 #ifndef MISC_HPP
2 #define MISC_HPP
3 
19 constexpr unsigned int str2int(const char* str, int h = 0)
20 {
21  return !str[h] ? 5381 : (str2int(str, h+1) * 33) ^ str[h];
22 }
23 
24 #endif
constexpr unsigned int str2int(const char *str, int h=0)
converting c_str() into constexpr int, which can be used in switch statement
Definition: Misc.hpp:19