mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 08:08:19 +00:00
btest portability fix
address review comment about shifting corner-case
This commit is contained in:
parent
ea3d25b380
commit
c10885e5f9
2 changed files with 4 additions and 4 deletions
|
@ -963,10 +963,10 @@ ValPtr BinaryExpr::Fold(Val* v1, Val* v2) const
|
|||
{
|
||||
if ( is_integral )
|
||||
{
|
||||
if ( i1 < 1 )
|
||||
if ( i1 < 0 )
|
||||
RuntimeError("left shifting a negative number is undefined");
|
||||
|
||||
i3 = i1 << i2;
|
||||
i3 = i1 << static_cast<zeek_uint_t>(i2);
|
||||
}
|
||||
|
||||
else if ( is_unsigned )
|
||||
|
@ -979,7 +979,7 @@ ValPtr BinaryExpr::Fold(Val* v1, Val* v2) const
|
|||
case EXPR_RSHIFT:
|
||||
{
|
||||
if ( is_integral )
|
||||
i3 = i1 >> i2;
|
||||
i3 = i1 >> static_cast<zeek_uint_t>(i2);
|
||||
|
||||
else if ( is_unsigned )
|
||||
u3 = u1 >> u2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue