[PATCH] D44429: [BinaryFormat] MessagePack reader/writer

Scott Linder via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 1 12:05:41 PDT 2018


scott.linder marked 6 inline comments as done.
scott.linder added inline comments.


================
Comment at: unittests/BinaryFormat/MsgPackWriterTest.cpp:549
+  std::string s;
+  s.assign(static_cast<uint16_t>(UINT8_MAX) + 1, 'a');
+  MemoryBufferRef Ref = MemoryBufferRef(s, "");
----------------
dblaikie wrote:
> What's the static_cast here for? I'd have thought the usual arithmetic conversions would've made UINT8_MAX + 1 work correctly here without the cast?
The static_cast may not be required here, but it is for e.g. TestWriteUInt64Min because `UINT32_MAX + 1` wraps (and I believe it is required for `UINT16_MAX + 1` as well). I added the cast in all the analogous tests to be consistent, but I can remove the UINT8 one if it is cleaner.


https://reviews.llvm.org/D44429





More information about the llvm-commits mailing list