summaryrefslogtreecommitdiff
path: root/tests/micropython/viper_ptr16_store.py
blob: 94cde2bc653394effa9222d76bd767212922e1e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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)