+/** @brief Return the @ref unidata structure for code point @p c
+ *
+ * @p c can be any 32-bit value, a sensible value will be returned regardless.
+ */
+static const struct unidata *utf32__unidata(uint32_t c) {
+ if(c < UNICODE_NCHARS)
+ return &unidata[c / UNICODE_MODULUS][c % UNICODE_MODULUS];
+ else if((c >= 0xF0000 && c <= 0xFFFFD)
+ || (c >= 0x100000 && c <= 0x10FFFD))
+ return utf32__unidata(0xE000); /* Co */
+ else
+ return utf32__unidata(0xFFFF); /* Cn */
+}
+