Skip to content
Unverified Commit f7dd2586 authored by Kazu Hirata's avatar Kazu Hirata Committed by GitHub
Browse files

[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.
parent d30fe62c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment