chiark / gitweb /
16-bit safety, maybe
Bedstead claims to be written in ISO C. ISO C allows "int" to be only
16 bits wide, which is a bit of a problem. In fact, it's not much of
a problem because Bedstead mostly deals in small numbers. The main
exception is Unicode code points, which can exceed 16 bits.
To hopefully fix this, Bedstead now mostly uses "long" for Unicode
code points. The main exception is in the gklph table where that
seems a bit profligate on 64-bit systems so I've used int_least32_t
instead.
The fiddliest bits of this are around uses of printf(), which cares
whether it's being passed an "int" or a "long".
This is untested on an actual 16-bit system, but at least on a 64-bit
system it continues to produce correct results.