[core] address nits

This commit is contained in:
Konstantin Käfer
2018-10-19 15:51:58 +02:00
parent 7692be5d15
commit 9afe75aa76
3 changed files with 5 additions and 5 deletions

View File

@@ -11,7 +11,7 @@ ProgramParameters::ProgramParameters(const float pixelRatio,
result.reserve(32);
result += "#define DEVICE_PIXEL_RATIO ";
result += util::toString(pixelRatio, true);
result += "\n";
result += '\n';
if (overdraw) {
result += "#define OVERDRAW_INSPECTOR\n";
}
@@ -33,7 +33,7 @@ optional<std::string> ProgramParameters::cachePath(const char* name) const {
result += *cacheDir;
result += "/com.mapbox.gl.shader.";
result += name;
result += ".";
result += '.';
result += util::toHex(std::hash<std::string>()(defines));
result += ".pbf";
return result;

View File

@@ -18,7 +18,7 @@ std::string vertexSource(const ProgramParameters& parameters, const char* vertex
std::string programIdentifier(const std::string& vertexSource, const std::string& fragmentSource) {
std::string result;
result.reserve(sizeof(size_t) * 2 * 2 + 2 + 1);
result.reserve((sizeof(size_t) * 2) * 2 + 2); // 2 size_t hex values + "v2"
result += util::toHex(std::hash<std::string>()(vertexSource));
result += util::toHex(std::hash<std::string>()(fragmentSource));
result += "v2";

View File

@@ -8,12 +8,12 @@ namespace mbgl {
namespace util {
template <class T>
inline void hash_combine(std::size_t& seed, const T& v) {
void hash_combine(std::size_t& seed, const T& v) {
seed ^= std::hash<T>()(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
}
template <class... Args>
inline std::size_t hash(Args&&... args) {
std::size_t hash(Args&&... args) {
std::size_t seed = 0;
ignore({ (hash_combine(seed, args), 0)... });
return seed;