diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2023-02-07 23:27:23 +0100 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2023-02-07 23:27:23 +0100 |
commit | e4cc7006c09e3e9de999ba52507ddd2ba9d58e49 (patch) | |
tree | 948da42b826aa320fee877bda519da64c277e09f /ebs.c | |
parent | optimization to allow clang (diff) | |
download | ebs-master.tar ebs-master.tar.gz ebs-master.tar.bz2 ebs-master.tar.lz ebs-master.tar.xz ebs-master.tar.zst ebs-master.zip |
Diffstat (limited to 'ebs.c')
-rw-r--r-- | ebs.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -19,7 +19,11 @@ typedef uint16_t naslov; */ struct ebs { +#ifdef FAST_RAM + int_fast32_t ram[(RAM_VELIKOST+2)*8]; +#else unsigned char ram[RAM_VELIKOST-2+2]; /**< ne vsebuje programskega števca, ampak vsebuje magic bite */ +#endif unsigned char * pm; unsigned pm_velikost; uint16_t pc; @@ -65,7 +69,11 @@ static bool peek (struct ebs * e, naslov a) { assert(a < RAM_VELIKOST*8+15); if (a < 16) return e->pc & (1 << (15-a)); +#ifdef FAST_RAM + return e->ram[a]; +#else return e->ram[a/8-2] & (1 << (a % 8)); +#endif } /** @@ -85,10 +93,14 @@ static void poke (struct ebs * e, naslov a, bool v) { e->pc &= ~(1 << (15-a)); return; } +#ifdef FAST_RAM + e->ram[a] = v; +#else if (v) e->ram[a/8-2] |= (1 << (a % 8)); else e->ram[a/8-2] &= ~(1 << (a % 8)); +#endif } static struct inštrukcija inštrukcija (struct ebs * e, naslov a) { |