Skip to content

Commit

Permalink
clcpp::GetTypeNameHash returns the hash as a constant rather than
Browse files Browse the repository at this point in the history
looking it up in the table. Two benefits:
* Faster runtime.
* Can be used immediately at startup without calling clcppInitGetType.
  • Loading branch information
dwilliamson committed Apr 9, 2021
1 parent b94a9d6 commit 5365dae
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 127 deletions.
4 changes: 2 additions & 2 deletions src/clReflectMerge/CodeGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,8 @@ namespace
{
std::string name = NameWithGlobalScope(prim);
cg.Line("template <> const Type* GetType< %s >() { return clcppTypePtrs[%d]; }", name.c_str(), i);
cg.Line("template <> unsigned int GetTypeNameHash< %s >() { return clcppTypeNameHashes[%d]; }", name.c_str(), i);
}
cg.Line("template <> unsigned int GetTypeNameHash< %s >() { return 0x%x; }", name.c_str(), prim.hash);
}
}
}
}
Expand Down
Loading

0 comments on commit 5365dae

Please sign in to comment.