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 <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2022-09-28 09:24:13 +02:00
parent b47733e5f0
commit a1d6ec66ce

View File

@@ -25,6 +25,7 @@
#include <com/sun/star/util/XCloneable.hpp>
#include <cppuhelper/implbase.hxx>
#include <rtl/math.h>
#include <sax/saxdllapi.h>
#include <string_view>
@@ -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
{