Skip to content

Commit 85c7a7f

Browse files
authored
[DirectX] Don't byte-swap returned byte-offset (llvm#155860)
- The returned byte offset from `rewriteOffsetToCurrentByte` should not be byte-swapped as it will be compared and interpreted as a uint32_t in its uses This commit corrects build failures that hit an assert on big-endian builds
1 parent 4a7205f commit 85c7a7f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/MC/DXContainerRootSignature.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ static uint32_t writePlaceholder(raw_svector_ostream &Stream) {
2222

2323
static uint32_t rewriteOffsetToCurrentByte(raw_svector_ostream &Stream,
2424
uint32_t Offset) {
25+
uint32_t ByteOffset = Stream.tell();
2526
uint32_t Value =
2627
support::endian::byte_swap<uint32_t, llvm::endianness::little>(
27-
Stream.tell());
28+
ByteOffset);
2829
Stream.pwrite(reinterpret_cast<const char *>(&Value), sizeof(Value), Offset);
29-
return Value;
30+
return ByteOffset;
3031
}
3132

3233
size_t RootSignatureDesc::getSize() const {

0 commit comments

Comments
 (0)