-/* We use all-bit-set marker to mean that a mapping is empty. It is
- (hopefully) illegal as a pointer, and it allows the users to use
- NULL (as well as any non-negative integer) as key. */
+/* We use the all-bits-set constant (INVALID_PTR) marker to mean that
+ a mapping is empty. It is unaligned and therefore illegal as a
+ pointer. INVALID_PTR_BYTE (0xff) is the one-byte value used to
+ initialize the mappings array as empty.
+
+ The all-bits-set value is a better choice than NULL because it
+ allows the use of NULL/0 keys. Since the keys are either integers
+ or pointers, the only key that cannot be used is the integer value
+ -1. This is acceptable because it still allows the use of
+ nonnegative integer keys. */
+
+#define INVALID_PTR ((void *) ~(unsigned long)0)
+#ifndef UCHAR_MAX
+# define UCHAR_MAX 0xff
+#endif
+#define INVALID_PTR_BYTE UCHAR_MAX