MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / VersionHashStr

Function VersionHashStr

src/strgen/strgen_base.cpp:117–124  ·  view source on GitHub ↗

* Create a compound hash. * @param hash The hash to add the string hash to. * @param s The string hash. * @return The new hash. */

Source from the content-addressed store, hash-verified

115 * @return The new hash.
116 */
117static uint32_t VersionHashStr(uint32_t hash, std::string_view s)
118{
119 for (auto c : s) {
120 hash = std::rotl(hash, 3) ^ c;
121 hash = (hash & 1 ? hash >> 1 ^ 0xDEADBEEF : hash >> 1);
122 }
123 return hash;
124}
125
126/**
127 * Make a hash of the file to get a unique "version number"

Callers 1

VersionMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected