summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSune Vuorela <sune@vuorela.dk>2024-02-02 10:36:44 +0100
committerSune Vuorela <sune@vuorela.dk>2024-02-02 10:36:44 +0100
commit7e66b9afe16e7eb559655d7c400cf4c1e6e04d26 (patch)
treeb80a00e2baef52db3dce94da1ffd2580352bb544
parent5ad744922aeed83ecf2bbdb83c783bbfc23b4192 (diff)
inline UnicodeIsValid
While profiling document loading, a lot was hitting this function; try let the compiler be smarter.
-rw-r--r--poppler/UTF.cc5
-rw-r--r--poppler/UTF.h5
2 files changed, 4 insertions, 6 deletions
diff --git a/poppler/UTF.cc b/poppler/UTF.cc
index 19d08e39..f8dd16f2 100644
--- a/poppler/UTF.cc
+++ b/poppler/UTF.cc
@@ -40,11 +40,6 @@
#include <config.h>
-bool UnicodeIsValid(Unicode ucs4)
-{
- return (ucs4 < 0x110000) && ((ucs4 & 0xfffff800) != 0xd800) && (ucs4 < 0xfdd0 || ucs4 > 0xfdef) && ((ucs4 & 0xfffe) != 0xfffe);
-}
-
std::vector<Unicode> UTF16toUCS4(const Unicode *utf16, int utf16Len)
{
// count characters
diff --git a/poppler/UTF.h b/poppler/UTF.h
index 5b7593f2..9c3c6817 100644
--- a/poppler/UTF.h
+++ b/poppler/UTF.h
@@ -43,7 +43,10 @@ std::vector<Unicode> UTF16toUCS4(const Unicode *utf16, int utf16Len);
std::vector<Unicode> POPPLER_PRIVATE_EXPORT TextStringToUCS4(const std::string &textStr);
// check if UCS-4 character is valid
-bool UnicodeIsValid(Unicode ucs4);
+inline bool UnicodeIsValid(Unicode ucs4)
+{
+ return (ucs4 < 0x110000) && ((ucs4 & 0xfffff800) != 0xd800) && (ucs4 < 0xfdd0 || ucs4 > 0xfdef) && ((ucs4 & 0xfffe) != 0xfffe);
+}
// is a unicode whitespace character
bool UnicodeIsWhitespace(Unicode ucs4);