Fixing bug in RSHIFT.

This commit is contained in:
Brad Nelson
2022-05-28 17:47:51 -07:00
parent a864b24347
commit f0cea166e4
2 changed files with 10 additions and 1 deletions

View File

@ -129,3 +129,12 @@ e: test-?dup
0 ?dup 0 =assert 0 ?dup 0 =assert
depth 0 =assert depth 0 =assert
;e ;e
e: test-lshift
$1234 4 lshift $12340 =assert
;e
e: test-rshift
$1234 4 rshift $123 =assert
-1 cell 8 * 1- rshift 1 =assert
;e

View File

@ -82,7 +82,7 @@ typedef struct {
tos = (ucell_t) w / (ucell_t) tos) \ tos = (ucell_t) w / (ucell_t) tos) \
X("*/MOD", SSMOD, SSMOD_FUNC) \ X("*/MOD", SSMOD, SSMOD_FUNC) \
Y(LSHIFT, tos = (*sp-- << tos)) \ Y(LSHIFT, tos = (*sp-- << tos)) \
Y(RSHIFT, tos = (*sp-- >> tos)) \ Y(RSHIFT, tos = (((ucell_t) *sp--) >> tos)) \
Y(AND, tos &= *sp--) \ Y(AND, tos &= *sp--) \
Y(OR, tos |= *sp--) \ Y(OR, tos |= *sp--) \
Y(XOR, tos ^= *sp--) \ Y(XOR, tos ^= *sp--) \