1
0
Fork 0
wasp-os/wasp/boards/simulator/micropython.py
Daniel Thompson fd64abe882 wasp: draw565: Optimize the 2-bit RLE drawing functions
There's a bunch of different changes here but there are only really three
big wins. The biggest win comes from restructuring the 2-bit RLE decode
loop to avoid the inner function (~20%) but the switch to 16-bit writes in
_fill() and adoption of quick_write (e.g. no CS toggling) are also
note worthy (and about 5% each).
2020-04-08 21:50:42 +01:00

23 lines
464 B
Python

# SPDX-License-Identifier: LGPL-3.0-or-later
# Copyright (C) 2020 Daniel Thompson
def const(fn):
return fn
def native(fn):
return fn
def viper(fn):
def ptr8(buf):
return buf
def ptr16(buf):
return memoryview(buf).cast('H')
# This is a bit of a hack since the scope for ptr8 won't be right
# but it does mean no changes to the client
fn.__globals__['ptr8'] = ptr8
fn.__globals__['ptr16'] = ptr16
return fn