aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/DBCS.h
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2025-04-03 14:52:19 +1100
committerNeil <nyamatongwe@gmail.com>2025-04-03 14:52:19 +1100
commitb4300bf40c1134231af48cab4f38c5394976d9a1 (patch)
tree9ee9c88ab3b5f19a1933ecc5dfd02d5d2c5e9d0b /src/DBCS.h
parentedb7369a2c6a19393dc413a9595a234969fc2731 (diff)
downloadscintilla-mirror-b4300bf40c1134231af48cab4f38c5394976d9a1.tar.gz
Turn on type conversion warnings for GCC and fix them.
Diffstat (limited to 'src/DBCS.h')
-rw-r--r--src/DBCS.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/DBCS.h b/src/DBCS.h
index 12bbaf986..ba6230649 100644
--- a/src/DBCS.h
+++ b/src/DBCS.h
@@ -31,11 +31,9 @@ bool IsDBCSValidSingleByte(int codePage, int ch) noexcept;
// Calculate a number from a DBCS byte pair that can be used to index into an array or map.
// Should only be called with genuine DBCS character pairs which means that ch1 has top bit set.
constexpr uint16_t DBCSIndex(char ch1, char ch2) noexcept {
- constexpr unsigned int highStart = 0x80U;
- constexpr unsigned int byteMultiply = 0x100U;
- const unsigned char uch1 = ch1;
+ const unsigned char uch1 = ch1 & 0x7F;
const unsigned char uch2 = ch2;
- return ((uch1 - highStart) * byteMultiply) + uch2;
+ return (uch1 << 8) | uch2;
}
struct DBCSPair {