From a1d6ec66ce4b8dd84f0962f9b749b831cbb05baf Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 28 Sep 2022 09:24:13 +0200 Subject: elide strlen cost in FastAttributeIter::toDouble by inlining the underlying code to rtl_str_toDouble Change-Id: If379bf40472455be93ca4da6ece25a126bed0b73 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140691 Tested-by: Jenkins Reviewed-by: Noel Grandin --- include/sax/fastattribs.hxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx index ef7e97884735..22512bd5a929 100644 --- a/include/sax/fastattribs.hxx +++ b/include/sax/fastattribs.hxx @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -172,7 +173,9 @@ public: double toDouble() const { assert(mnIdx < mrList.maAttributeTokens.size()); - return rtl_str_toDouble(mrList.getFastAttributeValue(mnIdx)); + const char* pStr = mrList.getFastAttributeValue(mnIdx); + sal_Int32 nLen = mrList.AttributeValueLength(mnIdx); + return rtl_math_stringToDouble(pStr, pStr + nLen, '.', 0, nullptr, nullptr); } bool toBoolean() const { -- cgit