summaryrefslogtreecommitdiff
path: root/sux.c
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2020-06-13 19:18:49 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2020-06-13 19:18:49 -0400
commitda19d2f59353ade607c715ed9ab7b81ba1407411 (patch)
tree53d717414101477c1bb6939d5915fab3880e84f8 /sux.c
parentf0d11f5dfad5dc19d5a274024933bb4c998d38a9 (diff)
Optimized, and cleaned up the codebase.
Diffstat (limited to 'sux.c')
-rw-r--r--sux.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/sux.c b/sux.c
index 9ae05f5..49ec881 100644
--- a/sux.c
+++ b/sux.c
@@ -47,6 +47,29 @@ double ipc;
struct timeval str[THREADS], en[THREADS];
#endif
+inline uint8_t get_addrsize(uint8_t prefix, uint8_t addrmode) {
+ uint8_t id = (prefix & 0x0C) >> 2;
+ switch (addrmode) {
+ case ZM:
+ switch (id) {
+ case 2: return 5;
+ case 3: return 3;
+ case 1: return 2;
+ case 0: return 0;
+ }
+ break;
+ case ABS:
+ switch (id) {
+ case 3: return 7;
+ case 2: return 6;
+ case 1: return 4;
+ case 0: return 1;
+ }
+ break;
+ }
+ return 0;
+}
+
void *run(void *args) {
struct suxthr *thr = (void *)args;
struct sux *cpu = &thr->sx;