diff options
author | Damien George <damien@micropython.org> | 2022-11-11 12:25:32 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2022-11-11 12:25:32 +1100 |
commit | 0698dd72ea3b9d7897e63c6e219061bff8d162cf (patch) | |
tree | b2452d489b6a131a53058eaa2d160ed65f5334ef /tests/micropython/viper_subscr_multi.py | |
parent | 451ded8d7b746bf73a1f4a4db500716cb7587257 (diff) |
py/emitnative: Ensure load_subscr does not clobber existing REG_ARG_2.
Follow up from a similar fix in 426785a19eeb12aef7383fbda4693575d8c4dddf
Fixes issue #6314.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests/micropython/viper_subscr_multi.py')
-rw-r--r-- | tests/micropython/viper_subscr_multi.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/micropython/viper_subscr_multi.py b/tests/micropython/viper_subscr_multi.py index 1561e5534..a2baba241 100644 --- a/tests/micropython/viper_subscr_multi.py +++ b/tests/micropython/viper_subscr_multi.py @@ -6,15 +6,24 @@ def f1(b: ptr8): b[0] += b[1] +b = bytearray(b"\x01\x02") +f1(b) +print(b) + + @micropython.viper def f2(b: ptr8, i: int): b[0] += b[i] b = bytearray(b"\x01\x02") -f1(b) -print(b) - -b = bytearray(b"\x01\x02") f2(b, 1) print(b) + + +@micropython.viper +def f3(b: ptr8) -> int: + return b[0] << 24 | b[1] << 16 | b[2] << 8 | b[3] + + +print(hex(f3(b"\x01\x02\x03\x04"))) |