[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/hash-table-perf 31950946290 04/35: Refactor: less egregious laye
From: |
Mattias Engdegård |
Subject: |
scratch/hash-table-perf 31950946290 04/35: Refactor: less egregious layering violation in composite.h |
Date: |
Thu, 4 Jan 2024 10:56:40 -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 681a2877cc2), Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 594152bf667 01/35: Add internal hash-table debug functions, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 9f94796b657 05/35: ; * src/fns.c (collect_interval): Move misplaced function., Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 31950946290 04/35: Refactor: less egregious layering violation in composite.h,
Mattias Engdegård <=
- scratch/hash-table-perf e2a6ce36d83 03/35: Decouple profiler from Lisp hash table internals, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 9141966be51 09/35: ; * src/alloc.c (purecopy_hash_table): Simplify, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf fdc390f8dc0 10/35: Abstract predicate and constant for unused hash keys, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf c4df6041de8 12/35: * src/print.c (print_object): Don't print hash table test if `eql`., Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf f3e985a16ba 14/35: Don't print or read the hash table size parameter, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 1ebd00f6d0a 21/35: Retype hash interfaces to use EMACS_UINT instead of Lisp fixnum, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf fc68176120f 24/35: Use hash_hash_t for storing hash values, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 4b5d9f92abe 13/35: * src/print.c (print_object): Don't print empty hash-table data, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 310f6584ccb 18/35: Allow zero hash table size, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf e53398ab698 26/35: ; Reorder structs (hash and test), Mattias Engdegård, 2024/01/04