mirror of
https://github.com/micropython/micropython.git
synced 2026-01-09 05:30:27 +01:00
py: Fix viper store on x86; add tests for viper ptr16.
This commit is contained in:
19
tests/micropython/viper_ptr16_store.py
Normal file
19
tests/micropython/viper_ptr16_store.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# test ptr16 type
|
||||
|
||||
@micropython.viper
|
||||
def set(dest:ptr16, val:int):
|
||||
dest[0] = val
|
||||
|
||||
@micropython.viper
|
||||
def memset(dest:ptr16, val:int, n:int):
|
||||
for i in range(n):
|
||||
dest[i] = val
|
||||
|
||||
b = bytearray(4)
|
||||
print(b)
|
||||
|
||||
set(b, 0x4242)
|
||||
print(b)
|
||||
|
||||
memset(b, 0x4343, len(b) // 2)
|
||||
print(b)
|
||||
3
tests/micropython/viper_ptr16_store.py.exp
Normal file
3
tests/micropython/viper_ptr16_store.py.exp
Normal file
@@ -0,0 +1,3 @@
|
||||
bytearray(b'\x00\x00\x00\x00')
|
||||
bytearray(b'BB\x00\x00')
|
||||
bytearray(b'CCCC')
|
||||
Reference in New Issue
Block a user