cdbmake key length and the magic number 429496720
Profpatsch <[email protected]> Fri, 05 Oct 2018 18:07:30 +0200
| Newsgroups | gmane.comp.djb.cdb |
|---|---|
| Message-ID | <[email protected]> |
cdbmake has the following code snippet for parsing in
the length of keys formatted as ASCII numbers:
klen =3D 0;
for (;;) {
get(&ch);
if (ch =3D=3D ',') break;
if ((ch < '0') || (ch > '9')) die_readformat();
if (klen > 429496720) { errno =3D error_nomem; die_write(); }
klen =3D klen * 10 + (ch - '0');
}
As you can observe, there is an undocumented magic number.
I can=E2=80=99t make sense of that number.
logBase2(429496720) ~ 28.67
Maybe 4GB limit
2^30*4 =3D=3D 4294967296
!=3D 429496720
I am confounded.
Profpatsch
--=20
Written with Emacs (mu4e) on NixOS.
Q: Why is this email five sentences or less?
A: http://five.sentenc.es/
May take up to five days to read your message. If it=E2=80=99s urgent, call=
me.