py: Fix viper store on x86; add tests for viper ptr16.

This commit is contained in:
Damien George
2014-09-29 21:41:41 +00:00
parent e9dac3b4d0
commit dfef4249eb
3 changed files with 36 additions and 1 deletions

View 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)

View File

@@ -0,0 +1,3 @@
bytearray(b'\x00\x00\x00\x00')
bytearray(b'BB\x00\x00')
bytearray(b'CCCC')