diff options
author | Kazu Hirata <kazu@google.com> | 2025-09-28 10:27:05 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-28 10:27:05 -0700 |
commit | f7dd258635af4d85bd8f25729c7f56aadb4c5913 (patch) | |
tree | ed64502e7c62462ecf69cade835d4bc8fd4e91e5 /llvm/unittests/Support/VirtualFileSystemTest.cpp | |
parent | d30fe62cf15960b0b0b2c15d315fe51bb718822a (diff) | |
download | llvm-f7dd258635af4d85bd8f25729c7f56aadb4c5913.zip llvm-f7dd258635af4d85bd8f25729c7f56aadb4c5913.tar.gz llvm-f7dd258635af4d85bd8f25729c7f56aadb4c5913.tar.bz2 |
[ADT] Fix a bug in PackedVector::setValue for signed types (#159239)
Without this patch, we forget to update the sign bit. When we assign:
Vec[0] = -1;
the sign bit is correctly set to 1. Overwriting the same element:
Vec[0] = 1;
does not update the sign bit, leaving the 4-bit as 0b1001, which reads
-2 according to PackedVector's encoding. (It does not use two's
complement.)
This patch fixes the bug by clearing the sign bit when we are
assigning a non-negative value.
Diffstat (limited to 'llvm/unittests/Support/VirtualFileSystemTest.cpp')
0 files changed, 0 insertions, 0 deletions