diff options
| author | Stefan Monnier | 2018-09-10 08:11:26 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2018-09-10 08:11:26 -0400 |
| commit | a65fe6fbf6f05789bb69c50de7b0946adf8773ac (patch) | |
| tree | 5f0a460819ec92091ff6b8b670033f1f9e5bff92 | |
| parent | 80a35ff2774b297baf0f12f02e1d8b521de640d5 (diff) | |
| download | emacs-a65fe6fbf6f05789bb69c50de7b0946adf8773ac.tar.gz emacs-a65fe6fbf6f05789bb69c50de7b0946adf8773ac.zip | |
* src/charset.c (Fencode_char): Explain when/why bignums are used
| -rw-r--r-- | src/charset.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/charset.c b/src/charset.c index e11a8366d58..6e2bf17cdf6 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -1886,6 +1886,13 @@ Return nil if CHARSET doesn't support CH. */) | |||
| 1886 | code = ENCODE_CHAR (charsetp, c); | 1886 | code = ENCODE_CHAR (charsetp, c); |
| 1887 | if (code == CHARSET_INVALID_CODE (charsetp)) | 1887 | if (code == CHARSET_INVALID_CODE (charsetp)) |
| 1888 | return Qnil; | 1888 | return Qnil; |
| 1889 | /* There are much fewer codepoints in the world than we have positive | ||
| 1890 | fixnums, so it could be argued that we never really need a bignum, | ||
| 1891 | e.g. Unicode codepoints only need 21bit, and China's GB-10830 | ||
| 1892 | can fit in 22bit. Yet we encode GB-10830's chars in a sparse way | ||
| 1893 | (we just take the 4byte sequences as a 32bit int), so some | ||
| 1894 | GB-10830 chars (such as 0x81308130 in etc/charsets/gb108304.map) end | ||
| 1895 | up represented as bignums here. */ | ||
| 1889 | return INT_TO_INTEGER (code); | 1896 | return INT_TO_INTEGER (code); |
| 1890 | } | 1897 | } |
| 1891 | 1898 | ||