diff options
author | Alex Zolotarev <alex@maps.me> | 2016-03-16 14:11:08 +0300 |
---|---|---|
committer | Sergey Yershov <yershov@corp.mail.ru> | 2016-03-23 16:56:29 +0300 |
commit | f459cae4c3520c4e44c486e10a92bb388f136399 (patch) | |
tree | b23f1f449c6395978871cc039dc8cffb23f8822c /base/string_utils.cpp | |
parent | 18571c4c9615b36904cb77037e6caaf15278aaa8 (diff) |
Speed up strings::to_XXX conversion by removing unnecessary variable check.
Diffstat (limited to 'base/string_utils.cpp')
-rw-r--r-- | base/string_utils.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/base/string_utils.cpp b/base/string_utils.cpp index f03f91ab28..30a619dd13 100644 --- a/base/string_utils.cpp +++ b/base/string_utils.cpp @@ -45,7 +45,7 @@ bool to_int(char const * s, int & i, int base /*= 10*/) { char * stop; long const x = strtol(s, &stop, base); - if (stop && *stop == 0) + if (*stop == 0) { i = static_cast<int>(x); ASSERT_EQUAL(static_cast<long>(i), x, ()); @@ -62,7 +62,7 @@ bool to_uint64(char const * s, uint64_t & i) #else i = strtoull(s, &stop, 10); #endif - return stop && *stop == 0; + return *stop == 0; } bool to_int64(char const * s, int64_t & i) @@ -73,14 +73,14 @@ bool to_int64(char const * s, int64_t & i) #else i = strtoll(s, &stop, 10); #endif - return stop && *stop == 0; + return *stop == 0; } bool to_double(char const * s, double & d) { char * stop; d = strtod(s, &stop); - return stop && *stop == 0 && s != stop; + return *stop == 0 && s != stop; } UniString MakeLowerCase(UniString const & s) |