Bug 867362 - part 1 - use MOZ_ALIGNOF instead of JS_ALIGN_OF_POINTER; r=luke

This change means that we no longer need the MOZ_ALIGN_OF_TYPE macro in
moznbytetype.m4.  And it's just nicer to have the compiler figure things
out for us rather than configury.
This commit is contained in:
Nathan Froyd 2013-04-30 16:11:54 -04:00
parent 2e0143bf24
commit b59eb06e7e
3 changed files with 2 additions and 5 deletions

View File

@ -2294,7 +2294,6 @@ else
AC_MSG_ERROR([Unexpected JS_BYTES_PER_WORD])
fi
MOZ_ALIGN_OF_TYPE(JS_ALIGN_OF_POINTER, void*, 2 4 8 16)
MOZ_SIZE_OF_TYPE(JS_BYTES_PER_DOUBLE, double, 6 8 10 12 14)
MOZ_CHECK_HEADERS(endian.h)

View File

@ -17,7 +17,6 @@
# define JS_BYTES_PER_DOUBLE 8
# define JS_BYTES_PER_WORD 8
# define JS_BITS_PER_WORD_LOG2 6
# define JS_ALIGN_OF_POINTER 8
# else /* !(defined(_M_X64) || defined(_M_AMD64) || defined(_AMD64_)) */
# error "CPU type is unknown"
# endif /* !(defined(_M_X64) || defined(_M_AMD64) || defined(_AMD64_)) */
@ -33,7 +32,6 @@
# define JS_BYTES_PER_DOUBLE 8
# define JS_BYTES_PER_WORD 4
# define JS_BITS_PER_WORD_LOG2 5
# define JS_ALIGN_OF_POINTER 4
#elif defined(__APPLE__)
# if __LITTLE_ENDIAN__

View File

@ -2838,7 +2838,7 @@ struct DataViewIO
static void fromBuffer(DataType *dest, const uint8_t *unalignedBuffer, bool wantSwap)
{
JS_ASSERT((reinterpret_cast<uintptr_t>(dest) & (Min<size_t>(JS_ALIGN_OF_POINTER, sizeof(DataType)) - 1)) == 0);
JS_ASSERT((reinterpret_cast<uintptr_t>(dest) & (Min<size_t>(MOZ_ALIGNOF(void*), sizeof(DataType)) - 1)) == 0);
memcpy((void *) dest, unalignedBuffer, sizeof(ReadWriteType));
if (wantSwap) {
ReadWriteType *rwDest = reinterpret_cast<ReadWriteType *>(dest);
@ -2848,7 +2848,7 @@ struct DataViewIO
static void toBuffer(uint8_t *unalignedBuffer, const DataType *src, bool wantSwap)
{
JS_ASSERT((reinterpret_cast<uintptr_t>(src) & (Min<size_t>(JS_ALIGN_OF_POINTER, sizeof(DataType)) - 1)) == 0);
JS_ASSERT((reinterpret_cast<uintptr_t>(src) & (Min<size_t>(MOZ_ALIGNOF(void*), sizeof(DataType)) - 1)) == 0);
ReadWriteType temp = *reinterpret_cast<const ReadWriteType *>(src);
if (wantSwap)
temp = swapBytes(temp);