Index: src/snapshot-source-sink.cc |
diff --git a/src/snapshot-source-sink.cc b/src/snapshot-source-sink.cc |
index 44f87060fc98f478926fe5a15f9130c1d56cdbca..2be14383fa6009f247f0a770ed370154422d5679 100644 |
--- a/src/snapshot-source-sink.cc |
+++ b/src/snapshot-source-sink.cc |
@@ -24,10 +24,14 @@ SnapshotByteSource::~SnapshotByteSource() { } |
int32_t SnapshotByteSource::GetUnalignedInt() { |
DCHECK(position_ < length_); // Require at least one byte left. |
+#if defined(V8_HOST_CAN_READ_UNALIGNED) && __BYTE_ORDER == __LITTLE_ENDIAN |
+ int32_t answer = *reinterpret_cast<const int32_t*>(data_ + position_); |
+#else |
int32_t answer = data_[position_]; |
answer |= data_[position_ + 1] << 8; |
answer |= data_[position_ + 2] << 16; |
answer |= data_[position_ + 3] << 24; |
+#endif |
return answer; |
} |