summaryrefslogtreecommitdiff
path: root/libs/androidfw/LocaleDataLookup.cpp
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2025-01-31 03:51:12 -0800
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2025-01-31 03:51:12 -0800
commit8c1b836852869b3c9ec56d63ead683828a725769 (patch)
tree61d95dca1608c52f151ae16023e0585b1790a27c /libs/androidfw/LocaleDataLookup.cpp
parent1ffeb28953acb494da186183f43ce7b2ca032de0 (diff)
parent533fa597f960c6e1d39415264704c59a64a188eb (diff)
Merge "Add benchmarks for LocaleDataLookup" into main am: 533fa597f9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3471369 Change-Id: I976238510c74a9df2ef9f4076ea2371d9f26fd26 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'libs/androidfw/LocaleDataLookup.cpp')
-rw-r--r--libs/androidfw/LocaleDataLookup.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/libs/androidfw/LocaleDataLookup.cpp b/libs/androidfw/LocaleDataLookup.cpp
index 6e751a77f355..ea9e9a2d4280 100644
--- a/libs/androidfw/LocaleDataLookup.cpp
+++ b/libs/androidfw/LocaleDataLookup.cpp
@@ -7518,6 +7518,13 @@ const char* lookupLikelyScript(uint32_t packed_lang_region) {
}
}
+/*
+ * TODO: Consider turning the below switch statement into binary search
+ * to save the disk space when the table is larger in the future.
+ * Disassembled code shows that the jump table emitted by clang can be
+ * 4x larger than the data in disk size, but it depends on the optimization option.
+ * However, a switch statement will benefit from the future of compiler improvement.
+ */
bool isLocaleRepresentative(uint32_t language_and_region, const char* script) {
const uint64_t packed_locale =
((static_cast<uint64_t>(language_and_region)) << 32u) |