[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/hash-table-perf 31950946290 04/37: Refactor: less egregious laye
From: |
Mattias Engdegård |
Subject: |
scratch/hash-table-perf 31950946290 04/37: Refactor: less egregious layering violation in composite.h |
Date: |
Sun, 7 Jan 2024 12:41:04 -0500 (EST) |
branch: scratch/hash-table-perf
commit 319509462904d4d480aee4535cdd35836437817e
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>
Refactor: less egregious layering violation in composite.h
Avoid using hash table internals directly.
* src/composite.h (COMPOSITION_KEY): New.
(COMPOSITION_GLYPH, COMPOSITION_RULE): Use COMPOSITION_KEY.
---
src/composite.h | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/composite.h b/src/composite.h
index 0f791c1ea62..a8497ff574f 100644
--- a/src/composite.h
+++ b/src/composite.h
@@ -84,23 +84,21 @@ composition_registered_p (Lisp_Object prop)
? XCDR (XCDR (XCDR (prop))) \
: CONSP (prop) ? XCDR (prop) : Qnil)
+#define COMPOSITION_KEY(cmp) \
+ HASH_KEY (XHASH_TABLE (composition_hash_table), (cmp)->hash_index)
+
/* Return the Nth glyph of composition specified by CMP. CMP is a
pointer to `struct composition'. */
#define COMPOSITION_GLYPH(cmp, n) \
- XFIXNUM (XVECTOR (XVECTOR (XHASH_TABLE (composition_hash_table)
\
- ->key_and_value) \
- ->contents[cmp->hash_index * 2]) \
- ->contents[cmp->method == COMPOSITION_WITH_RULE_ALTCHARS \
- ? (n) * 2 : (n)])
+ XFIXNUM (AREF (COMPOSITION_KEY (cmp),
\
+ (cmp)->method == COMPOSITION_WITH_RULE_ALTCHARS \
+ ? (n) * 2 : (n)))
/* Return the encoded composition rule to compose the Nth glyph of
rule-base composition specified by CMP. CMP is a pointer to
`struct composition'. */
-#define COMPOSITION_RULE(cmp, n) \
- XFIXNUM (XVECTOR (XVECTOR (XHASH_TABLE (composition_hash_table) \
- ->key_and_value) \
- ->contents[cmp->hash_index * 2]) \
- ->contents[(n) * 2 - 1])
+#define COMPOSITION_RULE(cmp, n) \
+ XFIXNUM (AREF (COMPOSITION_KEY (cmp), (n) * 2 - 1))
/* Decode encoded composition rule RULE_CODE into GREF (global
reference point code), NREF (new ref. point code). Don't check RULE_CODE;
- branch scratch/hash-table-perf created (now b9c9539db96), Mattias Engdegård, 2024/01/07
- scratch/hash-table-perf 422c91a822a 02/37: ; * src/pdumper.c (dump_hash_table): Remove unused argument., Mattias Engdegård, 2024/01/07
- scratch/hash-table-perf d77c9540363 06/37: Refactor: extract hash computation to a function, Mattias Engdegård, 2024/01/07
- scratch/hash-table-perf 9f94796b657 05/37: ; * src/fns.c (collect_interval): Move misplaced function., Mattias Engdegård, 2024/01/07
- scratch/hash-table-perf 594152bf667 01/37: Add internal hash-table debug functions, Mattias Engdegård, 2024/01/07
- scratch/hash-table-perf 3d2042c48a6 07/37: Refactor: extract hash index computation to a function, Mattias Engdegård, 2024/01/07
- scratch/hash-table-perf 9141966be51 09/37: ; * src/alloc.c (purecopy_hash_table): Simplify, Mattias Engdegård, 2024/01/07
- scratch/hash-table-perf 31950946290 04/37: Refactor: less egregious layering violation in composite.h,
Mattias Engdegård <=
- scratch/hash-table-perf 4e8d7725fd4 11/37: ; * src/fns.c (Fmake_hash_table): ensure `test` is a bare symbol, Mattias Engdegård, 2024/01/07
- scratch/hash-table-perf 4b5d9f92abe 13/37: * src/print.c (print_object): Don't print empty hash-table data, Mattias Engdegård, 2024/01/07
- scratch/hash-table-perf 3e9e68333ae 16/37: Remove rehash-threshold and rehash-size struct members, Mattias Engdegård, 2024/01/07
- scratch/hash-table-perf c188b9f2bf5 08/37: Refactor hash table vector reallocation, Mattias Engdegård, 2024/01/07
- scratch/hash-table-perf fdc390f8dc0 10/37: Abstract predicate and constant for unused hash keys, Mattias Engdegård, 2024/01/07
- scratch/hash-table-perf 6ffbccbf1dd 15/37: Represent hash table weakness as an enum internally, Mattias Engdegård, 2024/01/07
- scratch/hash-table-perf e69035c6ef5 17/37: Leaner hash table dumping and thawing, Mattias Engdegård, 2024/01/07
- scratch/hash-table-perf f3e985a16ba 14/37: Don't print or read the hash table size parameter, Mattias Engdegård, 2024/01/07
- scratch/hash-table-perf e2a6ce36d83 03/37: Decouple profiler from Lisp hash table internals, Mattias Engdegård, 2024/01/07
- scratch/hash-table-perf c4df6041de8 12/37: * src/print.c (print_object): Don't print hash table test if `eql`., Mattias Engdegård, 2024/01/07