Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] address nits
Browse files Browse the repository at this point in the history
  • Loading branch information
kkaefer committed Oct 22, 2018
1 parent f359d62 commit f0cfaad
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/mbgl/programs/program_parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/shaders/shaders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions src/mbgl/util/hash.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f0cfaad

Please sign in to comment.