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:27:26 -0800
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2025-01-31 03:27:26 -0800
commit533fa597f960c6e1d39415264704c59a64a188eb (patch)
tree61d95dca1608c52f151ae16023e0585b1790a27c /libs/androidfw/LocaleDataLookup.cpp
parent2473478f8080f7994b94162c1948efe1b33ea0bd (diff)
parentd0dde3c3533d2335293a94146bb089a90e50259e (diff)
Merge "Add benchmarks for LocaleDataLookup" into main
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) |