aboutsummaryrefslogtreecommitdiffstats
path: root/src/uxn/uxn.h
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-05-20 22:18:28 +0200
committerBad Diode <bd@badd10de.dev>2021-05-20 22:18:28 +0200
commitab6fdd0347920cdcda9c4c3c9c3f01996adc48db (patch)
tree02f714fdf9a10be96e1eb82b5ebc5834d04c9259 /src/uxn/uxn.h
parent1d6395f1b6aafce4e2e05bcf60f335bec0a8d4b3 (diff)
downloaduxngba-ab6fdd0347920cdcda9c4c3c9c3f01996adc48db.tar.gz
uxngba-ab6fdd0347920cdcda9c4c3c9c3f01996adc48db.zip
Apply asie's first performance patch
Diffstat (limited to 'src/uxn/uxn.h')
-rw-r--r--src/uxn/uxn.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/uxn/uxn.h b/src/uxn/uxn.h
index b2c90ac..b24d058 100644
--- a/src/uxn/uxn.h
+++ b/src/uxn/uxn.h
@@ -28,7 +28,7 @@ typedef struct {
28 28
29typedef struct { 29typedef struct {
30 Uint16 ptr; 30 Uint16 ptr;
31 Uint8 dat[KB(16)]; 31 Uint8 *dat;
32} Memory; 32} Memory;
33 33
34typedef struct Device { 34typedef struct Device {
@@ -45,8 +45,10 @@ typedef struct Uxn {
45 45
46struct Uxn; 46struct Uxn;
47 47
48void mempoke16(Uint8 *m, Uint16 a, Uint16 b); 48static inline void mempoke8(Uint8 *m, Uint16 a, Uint8 b) { m[a] = b; }
49Uint16 mempeek16(Uint8 *m, Uint16 a); 49static inline Uint8 mempeek8(Uint8 *m, Uint16 a) { return m[a]; }
50static inline void mempoke16(Uint8 *m, Uint16 a, Uint16 b) { mempoke8(m, a, b >> 8); mempoke8(m, a + 1, b); }
51static inline Uint16 mempeek16(Uint8 *m, Uint16 a) { return (mempeek8(m, a) << 8) + mempeek8(m, a + 1); }
50 52
51int loaduxn(Uxn *c, char *filepath); 53int loaduxn(Uxn *c, char *filepath);
52int bootuxn(Uxn *c); 54int bootuxn(Uxn *c);