提交 6e1347e6 编写于 作者: N Niels

fixes #270

上级 814fb31d
...@@ -485,6 +485,7 @@ I deeply appreciate the help of the following people. ...@@ -485,6 +485,7 @@ I deeply appreciate the help of the following people.
- [Tom Needham](https://github.com/06needhamt) fixed a subtle bug with MSVC 2015 which was also proposed by [Michael K.](https://github.com/Epidal). - [Tom Needham](https://github.com/06needhamt) fixed a subtle bug with MSVC 2015 which was also proposed by [Michael K.](https://github.com/Epidal).
- [Mário Feroldi](https://github.com/thelostt) fixed a small typo. - [Mário Feroldi](https://github.com/thelostt) fixed a small typo.
- [duncanwerner](https://github.com/duncanwerner) found a really embarrassing performance regression in the 2.0.0 release. - [duncanwerner](https://github.com/duncanwerner) found a really embarrassing performance regression in the 2.0.0 release.
- [Damien](https://github.com/dtoma) fixed one of the last conversion warnings.
Thanks a lot for helping out! Thanks a lot for helping out!
......
...@@ -5957,16 +5957,15 @@ class basic_json ...@@ -5957,16 +5957,15 @@ class basic_json
{ {
// convert a number 0..15 to its hex representation // convert a number 0..15 to its hex representation
// (0..f) // (0..f)
const auto hexify = [](const int v) -> char static const char hexify[16] =
{ {
return (v < 10) '0', '1', '2', '3', '4', '5', '6', '7',
? ('0' + static_cast<char>(v)) '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
: ('a' + static_cast<char>((v - 10) & 0x1f));
}; };
// print character c as \uxxxx // print character c as \uxxxx
for (const char m : for (const char m :
{ 'u', '0', '0', hexify(c >> 4), hexify(c & 0x0f) { 'u', '0', '0', hexify[c >> 4], hexify[c & 0x0f]
}) })
{ {
result[++pos] = m; result[++pos] = m;
......
...@@ -5957,18 +5957,15 @@ class basic_json ...@@ -5957,18 +5957,15 @@ class basic_json
{ {
// convert a number 0..15 to its hex representation // convert a number 0..15 to its hex representation
// (0..f) // (0..f)
const auto hexify = [](const int v) -> char static const char hexify[16] =
{ {
static const char hex[16] = { '0', '1', '2', '3', '0', '1', '2', '3', '4', '5', '6', '7',
'4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
'8', '9', 'a', 'b',
'c', 'd', 'e', 'f' };
return hex[v];
}; };
// print character c as \uxxxx // print character c as \uxxxx
for (const char m : for (const char m :
{ 'u', '0', '0', hexify(c >> 4), hexify(c & 0x0f) { 'u', '0', '0', hexify[c >> 4], hexify[c & 0x0f]
}) })
{ {
result[++pos] = m; result[++pos] = m;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册