diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2016-11-02 02:58:47 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2016-11-02 02:58:47 +0000 |
commit | 76a3ace1f0897906f59166b341008cf386b9e1f9 (patch) | |
tree | 96514c2b73b3f113dbb4459ee1830471b67e6545 /llvm/unittests/Bitcode | |
parent | a959393a1595917e2260fa3928f48a0db3b1f4fa (diff) | |
download | bcm5719-llvm-76a3ace1f0897906f59166b341008cf386b9e1f9.tar.gz bcm5719-llvm-76a3ace1f0897906f59166b341008cf386b9e1f9.zip |
Bitcode: Fix short read implementation.
We need to zero extend the byte in order to correctly shift it into a
64-bit value.
llvm-svn: 285785
Diffstat (limited to 'llvm/unittests/Bitcode')
-rw-r--r-- | llvm/unittests/Bitcode/BitstreamReaderTest.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/unittests/Bitcode/BitstreamReaderTest.cpp b/llvm/unittests/Bitcode/BitstreamReaderTest.cpp index b5bd4a6fb5a..986023ee3e9 100644 --- a/llvm/unittests/Bitcode/BitstreamReaderTest.cpp +++ b/llvm/unittests/Bitcode/BitstreamReaderTest.cpp @@ -158,4 +158,13 @@ TEST(BitstreamReaderTest, readRecordWithBlobWhileStreaming) { } } +TEST(BitstreamReaderTest, shortRead) { + uint8_t Bytes[] = {8, 7, 6, 5, 4, 3, 2, 1}; + for (unsigned I = 1; I != 8; ++I) { + BitstreamReader Reader(ArrayRef<uint8_t>(Bytes, I)); + SimpleBitstreamCursor Cursor(Reader); + EXPECT_EQ(8ull, Cursor.Read(8)); + } +} + } // end anonymous namespace |