2011-04-19 Paul Eggert <eggert@cs.ucla.edu>
+ * alloc.c (SDATA_SIZE) [!GC_CHECK_STRING_BYTES]: Avoid runtime check
+ in the common case where SDATA_DATA_OFFSET is a multiple of Emacs
+ word size.
+
* gnutls.c: Fix problems found by GCC 4.6.0 on Ubuntu 10.10.
(gnutls_make_error): Rename local to avoid shadowing.
(gnutls_emacs_global_deinit): ifdef out; not used.
#else /* not GC_CHECK_STRING_BYTES */
-#define SDATA_SIZE(NBYTES) \
- ((SDATA_DATA_OFFSET \
- + max (NBYTES, sizeof (EMACS_INT) - 1) + 1 \
- + sizeof (EMACS_INT) - 1) \
+/* The 'max' reserves space for the nbytes union member even when NBYTES + 1 is
+ less than the size of that member. The 'max' is not needed when
+ SDATA_DATA_OFFSET is a multiple of sizeof (EMACS_INT), because then the
+ alignment code reserves enough space. */
+
+#define SDATA_SIZE(NBYTES) \
+ ((SDATA_DATA_OFFSET \
+ + (SDATA_DATA_OFFSET % sizeof (EMACS_INT) == 0 \
+ ? NBYTES \
+ : max (NBYTES, sizeof (EMACS_INT) - 1)) \
+ + 1 \
+ + sizeof (EMACS_INT) - 1) \
& ~(sizeof (EMACS_INT) - 1))
#endif /* not GC_CHECK_STRING_BYTES */