Commit cb6dd4ef authored by liujisi@google.com's avatar liujisi@google.com

A workaround for MSVC 2010 x64 platform bug,

which affects proto compiler in generating field has_bit mask.
parent 2a89d002
...@@ -670,7 +670,14 @@ char *InternalFastHexToBuffer(uint64 value, char* buffer, int num_byte) { ...@@ -670,7 +670,14 @@ char *InternalFastHexToBuffer(uint64 value, char* buffer, int num_byte) {
static const char *hexdigits = "0123456789abcdef"; static const char *hexdigits = "0123456789abcdef";
buffer[num_byte] = '\0'; buffer[num_byte] = '\0';
for (int i = num_byte - 1; i >= 0; i--) { for (int i = num_byte - 1; i >= 0; i--) {
#ifdef _M_X64
// MSVC x64 platform has a bug optimizing the uint32(value) in the #else
// block. Given that the uint32 cast was to improve performance on 32-bit
// platforms, we use 64-bit '&' directly.
buffer[i] = hexdigits[value & 0xf];
#else
buffer[i] = hexdigits[uint32(value) & 0xf]; buffer[i] = hexdigits[uint32(value) & 0xf];
#endif
value >>= 4; value >>= 4;
} }
return buffer; return buffer;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment