aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2018-06-01 10:00:10 +1000
committerNeil <nyamatongwe@gmail.com>2018-06-01 10:00:10 +1000
commitcda15451a1c1b177a18d51c4523d44db48622f6a (patch)
tree4a3a33eba660d8a2a0ded0d3248252bf8c1d195a
parentc31087a0aab296176f8a8c16369855edc79b8e06 (diff)
downloadscintilla-mirror-cda15451a1c1b177a18d51c4523d44db48622f6a.tar.gz
Backport: Mark constant inline Unicode functions as constexpr.
Backport of changeset 7010:ec151858258f.
-rw-r--r--src/UniConversion.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/UniConversion.h b/src/UniConversion.h
index 4cdfe1fac..0eb9f5378 100644
--- a/src/UniConversion.h
+++ b/src/UniConversion.h
@@ -38,11 +38,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;
}
@@ -72,11 +72,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;
}