Browse code

Allow shifts up to 0xf in byte mode

Andrew Alderwick authored on 03/11/2021 07:15:14
Showing 1 changed files
... ...
@@ -478,7 +478,7 @@ uxn_eval(Uxn *u, Uint16 vec)
478 478
 		case 0x1f: /* SFT */
479 479
 			{
480 480
 				Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
481
-				u->wst.dat[u->wst.ptr - 2] = b >> (a & 0x07) << ((a & 0x70) >> 4);
481
+				u->wst.dat[u->wst.ptr - 2] = b >> (a & 0x0f) << ((a & 0xf0) >> 4);
482 482
 #ifndef NO_STACK_CHECKS
483 483
 				if(__builtin_expect(u->wst.ptr < 2, 0)) {
484 484
 					u->wst.error = 1;
... ...
@@ -1384,7 +1384,7 @@ uxn_eval(Uxn *u, Uint16 vec)
1384 1384
 		case 0x5f: /* SFTr */
1385 1385
 			{
1386 1386
 				Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
1387
-				u->rst.dat[u->rst.ptr - 2] = b >> (a & 0x07) << ((a & 0x70) >> 4);
1387
+				u->rst.dat[u->rst.ptr - 2] = b >> (a & 0x0f) << ((a & 0xf0) >> 4);
1388 1388
 #ifndef NO_STACK_CHECKS
1389 1389
 				if(__builtin_expect(u->rst.ptr < 2, 0)) {
1390 1390
 					u->rst.error = 1;
... ...
@@ -2374,7 +2374,7 @@ uxn_eval(Uxn *u, Uint16 vec)
2374 2374
 		case 0x9f: /* SFTk */
2375 2375
 			{
2376 2376
 				Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
2377
-				u->wst.dat[u->wst.ptr] = b >> (a & 0x07) << ((a & 0x70) >> 4);
2377
+				u->wst.dat[u->wst.ptr] = b >> (a & 0x0f) << ((a & 0xf0) >> 4);
2378 2378
 #ifndef NO_STACK_CHECKS
2379 2379
 				if(__builtin_expect(u->wst.ptr < 2, 0)) {
2380 2380
 					u->wst.error = 1;
... ...
@@ -3448,7 +3448,7 @@ uxn_eval(Uxn *u, Uint16 vec)
3448 3448
 		case 0xdf: /* SFTkr */
3449 3449
 			{
3450 3450
 				Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
3451
-				u->rst.dat[u->rst.ptr] = b >> (a & 0x07) << ((a & 0x70) >> 4);
3451
+				u->rst.dat[u->rst.ptr] = b >> (a & 0x0f) << ((a & 0xf0) >> 4);
3452 3452
 #ifndef NO_STACK_CHECKS
3453 3453
 				if(__builtin_expect(u->rst.ptr < 2, 0)) {
3454 3454
 					u->rst.error = 1;