summaryrefslogtreecommitdiff
path: root/datatest.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-05-14 04:09:26 -0400
committerJeffrey Walton <noloader@gmail.com>2017-05-14 04:09:26 -0400
commit017f7f61b40f101b03ed3d276526b5f550eb79bd (patch)
treeb246403a8a62925a1401ad6ff338a0ffcd488dc3 /datatest.cpp
parent2c570e27a02bfcab2eda02b9d61cde9ef2624899 (diff)
downloadcryptopp-git-017f7f61b40f101b03ed3d276526b5f550eb79bd.tar.gz
Rearrange characters in whitespace string
The arrangement saves about 1.3 seconds when running the test vectors. It looks like the tab character is dominant, so we profit by listing it first.
Diffstat (limited to 'datatest.cpp')
-rw-r--r--datatest.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/datatest.cpp b/datatest.cpp
index 64065ea3..97be8d20 100644
--- a/datatest.cpp
+++ b/datatest.cpp
@@ -712,20 +712,19 @@ bool GetField(std::istream &is, std::string &name, std::string &value)
}
}
- // Leading, trailing and temp position. The leading position moves right, and
- // trailing position moves left. The sub-string in the middle is the value for
- // the name. We leave one space when line continuation is in effect, (and if
- // present). The value can be an empty string. One Plaintext value is often
- // empty for algorithm testing.
+ // Leading and trailing position. The leading position moves right, and
+ // trailing position moves left. The sub-string in the middle is the value
+ // for the name. We leave one space when line continuation is in effect.
+ // The value can be an empty string. One Plaintext value is often empty
+ // for algorithm testing.
std::string::size_type l=0, t=std::string::npos;
- const std::string whitespace = " \r\n\t\v\f";
+ const std::string whitespace = "\t \r\n";
l = line.find_first_not_of(whitespace, l);
if (l == std::string::npos) { l = 0; }
t = line.find('#', l);
if (t != std::string::npos) { t--; }
-
- t = line.find_last_not_of(whitespace+"\\", t);
+ t = line.find_last_not_of(whitespace, t);
if (t != std::string::npos) { t++; }
CRYPTOPP_ASSERT(t >= l);