[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master a65fe6f: * src/charset.c (Fencode_char): Explain wh
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] master a65fe6f: * src/charset.c (Fencode_char): Explain when/why bignums are used |
Date: |
Mon, 10 Sep 2018 08:11:30 -0400 (EDT) |
branch: master
commit a65fe6fbf6f05789bb69c50de7b0946adf8773ac
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>
* src/charset.c (Fencode_char): Explain when/why bignums are used
---
src/charset.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/charset.c b/src/charset.c
index e11a836..6e2bf17 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1886,6 +1886,13 @@ Return nil if CHARSET doesn't support CH. */)
code = ENCODE_CHAR (charsetp, c);
if (code == CHARSET_INVALID_CODE (charsetp))
return Qnil;
+ /* There are much fewer codepoints in the world than we have positive
+ fixnums, so it could be argued that we never really need a bignum,
+ e.g. Unicode codepoints only need 21bit, and China's GB-10830
+ can fit in 22bit. Yet we encode GB-10830's chars in a sparse way
+ (we just take the 4byte sequences as a 32bit int), so some
+ GB-10830 chars (such as 0x81308130 in etc/charsets/gb108304.map) end
+ up represented as bignums here. */
return INT_TO_INTEGER (code);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master a65fe6f: * src/charset.c (Fencode_char): Explain when/why bignums are used,
Stefan Monnier <=