-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Avoid using <locale> and <iostream> #13135
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! LGTM % nits
result += *cacheDir; | ||
result += "/com.mapbox.gl.shader."; | ||
result += name; | ||
result += "."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit result += '.'; // as a symbol
result.reserve(32); | ||
result += "#define DEVICE_PIXEL_RATIO "; | ||
result += util::toString(pixelRatio, true); | ||
result += "\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: result += '\n';
src/mbgl/shaders/shaders.cpp
Outdated
ss << "v2"; | ||
return ss.str(); | ||
std::string result; | ||
result.reserve(sizeof(size_t) * 2 * 2 + 2 + 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a comment explaining sizeof(size_t) * 2 * 2 + 2 + 1
would be great
src/mbgl/util/hash.hpp
Outdated
namespace util { | ||
|
||
template <class T> | ||
inline void hash_combine(std::size_t& seed, const T& v) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
think inline
is not needed for a template function
src/mbgl/util/hash.hpp
Outdated
} | ||
|
||
template <class... Args> | ||
inline std::size_t hash(Args&&... args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
|
||
template <class... Args> | ||
inline std::size_t hash(Args&&... args) { | ||
std::size_t seed = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: = 0u;
…hout trailing ".0"
Some of our uses of
<locale>
increase binary size quite a bit. This removes most uses of<locale>
. Additionally,<iostream>
in combination with<iomanip>
significantly increases the binary size as well. Instead, we're now always using RapidJSON's floating point stringification algorithm.