projects
/
platform
/
upstream
/
SPIRV-Tools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9e11c7d
)
Avoid strlen in a loop, for speed.
author
David Neto
<dneto@google.com>
Thu, 15 Oct 2015 20:40:04 +0000
(16:40 -0400)
committer
David Neto
<dneto@google.com>
Mon, 26 Oct 2015 16:55:33 +0000
(12:55 -0400)
source/binary.cpp
patch
|
blob
|
history
diff --git
a/source/binary.cpp
b/source/binary.cpp
index
4e15d2d
..
8512811
100644
(file)
--- a/
source/binary.cpp
+++ b/
source/binary.cpp
@@
-244,11
+244,11
@@
spv_result_t spvBinaryDecodeOperand(
stream.get() << "\"";
stream.get() << (color ? clr::green() : "");
- for (
size_t i = 0; i < strlen(string); ++i
) {
- if(
string[i] == '"' || string[i]
== '\\') {
+ for (
const char* p = string; *p; ++p
) {
+ if(
*p == '"' || *p
== '\\') {
stream.get() << '\\';
}
- stream.get() <<
string[i]
;
+ stream.get() <<
*p
;
}
stream.get() << (color ? clr::reset() : "");
stream.get() << "\"";