diff options
author | Neil <nyamatongwe@gmail.com> | 2018-06-01 10:00:10 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2018-06-01 10:00:10 +1000 |
commit | e67783d907b0ae186d794b205cf89c645fe50270 (patch) | |
tree | c120c9fa95a0be7485a609d7cb05795cb2a00de4 | |
parent | 2aaf735e921f9676f520c5423d018441a0a83c57 (diff) | |
download | scintilla-mirror-e67783d907b0ae186d794b205cf89c645fe50270.tar.gz |
Mark constant inline Unicode functions as constexpr.
-rw-r--r-- | src/UniConversion.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/UniConversion.h b/src/UniConversion.h index e2be40776..6d257cd8e 100644 --- a/src/UniConversion.h +++ b/src/UniConversion.h @@ -39,11 +39,11 @@ inline int UnicodeFromUTF8(const unsigned char *us) noexcept { } } -inline bool UTF8IsTrailByte(unsigned char ch) noexcept { +inline constexpr bool UTF8IsTrailByte(unsigned char ch) noexcept { return (ch >= 0x80) && (ch < 0xc0); } -inline bool UTF8IsAscii(int ch) noexcept { +inline constexpr bool UTF8IsAscii(int ch) noexcept { return ch < 0x80; } @@ -73,11 +73,11 @@ enum { SURROGATE_TRAIL_FIRST = 0xDC00 }; enum { SURROGATE_TRAIL_LAST = 0xDFFF }; enum { SUPPLEMENTAL_PLANE_FIRST = 0x10000 }; -inline unsigned int UTF16CharLength(wchar_t uch) noexcept { +inline constexpr unsigned int UTF16CharLength(wchar_t uch) noexcept { return ((uch >= SURROGATE_LEAD_FIRST) && (uch <= SURROGATE_LEAD_LAST)) ? 2 : 1; } -inline unsigned int UTF16LengthFromUTF8ByteCount(unsigned int byteCount) noexcept { +inline constexpr unsigned int UTF16LengthFromUTF8ByteCount(unsigned int byteCount) noexcept { return (byteCount < 4) ? 1 : 2; } |