Skip to content

Commit 4288569

Browse files
yoneymeta-codesync[bot]
authored andcommitted
Move the active BitVector union member
Summary: Copy the active BitVector union member during moves instead of always reading bits. Reviewed By: DinoV Differential Revision: D116938582 fbshipit-source-id: 19da7f9ba1bb370fe3322259170b23323a691030
1 parent 25c3f6c commit 4288569

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

cinderx/Jit/bitvector.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,12 @@ BitVector& BitVector::operator=(BitVector&& rhs) noexcept {
7676
delete bit_vec;
7777
}
7878

79-
// Doesn't matter which union member is being written here.
8079
num_bits_ = rhs.num_bits_;
81-
bits = rhs.bits;
80+
if (rhs.isShortVector()) {
81+
bits = rhs.bits;
82+
} else {
83+
bit_vec = rhs.bit_vec;
84+
}
8285
rhs.num_bits_ = 0;
8386
rhs.bits = 0;
8487

0 commit comments

Comments
 (0)