Add more test coverage for RGBASM (#1256)

This also fixes two bugs: `-1 >>> 32` was -1 not 0, and `macro_FreeArgs` should have been called but wasn't.
This commit is contained in:
Rangi
2023-11-29 15:16:05 -05:00
committed by GitHub
parent b46aa0f55b
commit cee3d1c859
51 changed files with 238 additions and 80 deletions

View File

@@ -60,7 +60,7 @@ int32_t op_shift_right(int32_t value, int32_t amount)
// Repeat the easy cases here to avoid INT_MIN funny business
if (amount == 0)
return value;
if (value == 0 || amount <= -32)
if (value == 0 || amount < -31)
return 0;
if (amount > 31)
return (value < 0) ? -1 : 0;
@@ -84,10 +84,8 @@ int32_t op_shift_right_unsigned(int32_t value, int32_t amount)
// Repeat the easy cases here to avoid INT_MIN funny business
if (amount == 0)
return value;
if (value == 0 || amount <= -32)
if (value == 0 || amount < -31 || amount > 31)
return 0;
if (amount > 31)
return (value < 0) ? -1 : 0;
if (amount < 0)
return op_shift_left(value, -amount);