Skip to content

Commit 6480fe2

Browse files
[llvm] Drop unaligned from calls to llvm::support::endian::{read,write} (NFC)
The last template parameter of llvm::support::endian::{read,write} defaults to unaligned, so we can drop that at call sites.
1 parent c98bf1e commit 6480fe2

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

llvm/include/llvm/Support/BinaryStreamReader.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ class BinaryStreamReader {
7373
if (auto EC = readBytes(Bytes, sizeof(T)))
7474
return EC;
7575

76-
Dest = llvm::support::endian::read<T, llvm::support::unaligned>(
77-
Bytes.data(), Stream.getEndian());
76+
Dest = llvm::support::endian::read<T>(Bytes.data(), Stream.getEndian());
7877
return Error::success();
7978
}
8079

llvm/include/llvm/Support/BinaryStreamWriter.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ class BinaryStreamWriter {
5959
static_assert(std::is_integral_v<T>,
6060
"Cannot call writeInteger with non-integral value!");
6161
uint8_t Buffer[sizeof(T)];
62-
llvm::support::endian::write<T, llvm::support::unaligned>(
63-
Buffer, Value, Stream.getEndian());
62+
llvm::support::endian::write<T>(Buffer, Value, Stream.getEndian());
6463
return writeBytes(Buffer);
6564
}
6665

llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,17 +318,17 @@ class RuntimeDyldImpl {
318318
std::string ErrorStr;
319319

320320
void writeInt16BE(uint8_t *Addr, uint16_t Value) {
321-
llvm::support::endian::write<uint16_t, llvm::support::unaligned>(
321+
llvm::support::endian::write<uint16_t>(
322322
Addr, Value, IsTargetLittleEndian ? support::little : support::big);
323323
}
324324

325325
void writeInt32BE(uint8_t *Addr, uint32_t Value) {
326-
llvm::support::endian::write<uint32_t, llvm::support::unaligned>(
326+
llvm::support::endian::write<uint32_t>(
327327
Addr, Value, IsTargetLittleEndian ? support::little : support::big);
328328
}
329329

330330
void writeInt64BE(uint8_t *Addr, uint64_t Value) {
331-
llvm::support::endian::write<uint64_t, llvm::support::unaligned>(
331+
llvm::support::endian::write<uint64_t>(
332332
Addr, Value, IsTargetLittleEndian ? support::little : support::big);
333333
}
334334

0 commit comments

Comments
 (0)