From c72f71e61eedcd3107f5fdaff37d7639311709d9 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Fri, 17 Feb 2023 17:16:25 +0100 Subject: [PATCH] Reorder chan struct to reduce cache misses --- src/emu/chan.c | 6 +++--- src/emu/chan.h | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/emu/chan.c b/src/emu/chan.c index 9d01d5d..4c3b3ac 100644 --- a/src/emu/chan.c +++ b/src/emu/chan.c @@ -98,10 +98,10 @@ chan_set(struct chan *chan, struct value value) return -1; } +#ifdef ENABLE_DEBUG char buf[128]; - UNUSED(buf); - dbg("%s: sets value to %s\n", - chan->name, value_str(value, buf)); + dbg("%s: sets value to %s", chan->name, value_str(value, buf)); +#endif chan->data.value = value; if (set_dirty(chan) != 0) { diff --git a/src/emu/chan.h b/src/emu/chan.h index 536c4fb..b9f5814 100644 --- a/src/emu/chan.h +++ b/src/emu/chan.h @@ -43,14 +43,14 @@ struct chan; typedef int (*chan_cb_t)(struct chan *chan, void *ptr); struct chan { - char name[MAX_CHAN_NAME]; - enum chan_type type; - union chan_data data; int is_dirty; int prop[CHAN_MAXPROP]; - struct value last_value; chan_cb_t dirty_cb; void *dirty_arg; + struct value last_value; + enum chan_type type; + union chan_data data; + char name[MAX_CHAN_NAME]; }; void chan_init(struct chan *chan, enum chan_type type, const char *fmt, ...);