From 525d4bcc342360926f5f6b6f717db409699d16e9 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Mon, 24 Aug 2020 00:45:42 +1000 Subject: [PATCH] Add hexadecimal limits to doc/note/base38-etc --- doc/note/base38-and-fourcc.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/note/base38-and-fourcc.md b/doc/note/base38-and-fourcc.md index 7a4f3502..c2888ac0 100644 --- a/doc/note/base38-and-fourcc.md +++ b/doc/note/base38-and-fourcc.md @@ -33,7 +33,8 @@ Base38 is a tighter encoding than FourCC, fitting four characters into 21 bits instead of 32 bits. This is achieved by using a smaller alphabet of 38 possible values (space, 0-9, ? or a-z), so that it cannot distinguish between e.g. an upper case 'X' and a lower case 'x'. There's also the happy coincidence that -`38 ** 4`, `2085136`, is slightly smaller than `2 ** 21`, `2097152`. +`38 ** 4 = 0x1FD110 = 2085136` is slightly smaller than `2 ** 21 = 0x200000 = +2097152`. The base38 encoding of `"JPEG"` is `0x122FF6`, which is `1191926`, which is `((21 * (38 ** 3)) + (27 * (38 ** 2)) + (16 * (38 ** 1)) + (18 * (38 ** 0)))`.