+#if defined(DEBUG) && defined(__GNUC__) && !defined(__ICC) && \
+ !defined(__INTEL_COMPILER) && !defined(__SUNPRO_C)
+extern unsigned int eek_ord;
+#define ORD(c) ((size_t)(c) > 0xFF ? eek_ord : \
+ ((unsigned int)(unsigned char)(c)))
+#define ord(c) __builtin_choose_expr( \
+ __builtin_types_compatible_p(__typeof__(c), char) || \
+ __builtin_types_compatible_p(__typeof__(c), unsigned char), \
+ ((unsigned int)(unsigned char)(c)), ({ \
+ size_t ord_c = (c); \
+ \
+ if (ord_c > (size_t)0xFFU) \
+ internal_errorf("%s:%d:ord(%zX)", \
+ __FILE__, __LINE__, ord_c); \
+ ((unsigned int)(unsigned char)(ord_c)); \
+}))
+#else
+#define ord(c) ((unsigned int)(unsigned char)(c))
+#define ORD(c) ord(c) /* may evaluate arguments twice */
+#endif