Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions lldb/source/Utility/Scalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,24 +471,10 @@ bool Scalar::ShiftRightLogical(const Scalar &rhs) {
}

Scalar &Scalar::operator>>=(const Scalar &rhs) {
switch (m_type) {
case e_void:
case e_float:
if (m_type == e_int && rhs.m_type == e_int)
m_integer >>= rhs.m_integer.getZExtValue();
else
m_type = e_void;
break;

case e_int:
switch (rhs.m_type) {
case e_void:
case e_float:
m_type = e_void;
break;
case e_int:
m_integer = m_integer.ashr(rhs.m_integer);
break;
}
break;
}
return *this;
}

Expand Down
3 changes: 3 additions & 0 deletions lldb/unittests/Utility/ScalarTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,14 @@ TEST(ScalarTest, RightShiftOperator) {
int a = 0x00001000;
int b = 0xFFFFFFFF;
int c = 4;
unsigned d = 0xFFFFFFFF;
Scalar a_scalar(a);
Scalar b_scalar(b);
Scalar c_scalar(c);
Scalar d_scalar(d);
ASSERT_EQ(a >> c, a_scalar >> c_scalar);
ASSERT_EQ(b >> c, b_scalar >> c_scalar);
ASSERT_EQ(d >> c, d_scalar >> c_scalar);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also add a test for unsigned short?

}

TEST(ScalarTest, GetBytes) {
Expand Down
Loading