diff options
author | Bad Diode <bd@badd10de.dev> | 2021-05-20 22:18:28 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2021-05-20 22:18:28 +0200 |
commit | ab6fdd0347920cdcda9c4c3c9c3f01996adc48db (patch) | |
tree | 02f714fdf9a10be96e1eb82b5ebc5834d04c9259 /src/uxn/uxn.h | |
parent | 1d6395f1b6aafce4e2e05bcf60f335bec0a8d4b3 (diff) | |
download | uxngba-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.h | 8 |
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 | ||
29 | typedef struct { | 29 | typedef struct { |
30 | Uint16 ptr; | 30 | Uint16 ptr; |
31 | Uint8 dat[KB(16)]; | 31 | Uint8 *dat; |
32 | } Memory; | 32 | } Memory; |
33 | 33 | ||
34 | typedef struct Device { | 34 | typedef struct Device { |
@@ -45,8 +45,10 @@ typedef struct Uxn { | |||
45 | 45 | ||
46 | struct Uxn; | 46 | struct Uxn; |
47 | 47 | ||
48 | void mempoke16(Uint8 *m, Uint16 a, Uint16 b); | 48 | static inline void mempoke8(Uint8 *m, Uint16 a, Uint8 b) { m[a] = b; } |
49 | Uint16 mempeek16(Uint8 *m, Uint16 a); | 49 | static inline Uint8 mempeek8(Uint8 *m, Uint16 a) { return m[a]; } |
50 | static inline void mempoke16(Uint8 *m, Uint16 a, Uint16 b) { mempoke8(m, a, b >> 8); mempoke8(m, a + 1, b); } | ||
51 | static inline Uint16 mempeek16(Uint8 *m, Uint16 a) { return (mempeek8(m, a) << 8) + mempeek8(m, a + 1); } | ||
50 | 52 | ||
51 | int loaduxn(Uxn *c, char *filepath); | 53 | int loaduxn(Uxn *c, char *filepath); |
52 | int bootuxn(Uxn *c); | 54 | int bootuxn(Uxn *c); |