From fb383b792d1044405188e42c4b827858c4a3a038 Mon Sep 17 00:00:00 2001 From: Gediminas Jakutis Date: Mon, 15 Feb 2021 09:18:31 +0200 Subject: now with generating lists! Signed-off-by: Gediminas Jakutis --- src/defs.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/defs.h') diff --git a/src/defs.h b/src/defs.h index 39960d9..f6a7f91 100644 --- a/src/defs.h +++ b/src/defs.h @@ -30,6 +30,18 @@ .get_next_element_cache = stub_getnext, .place_next_element_direct = stub_put, \ .place_next_element_cache = stub_put, .split = stub_split, .flush = stub_flush +union nextoff { + struct entry_l *next; + ptrdiff_t offset; + int64_t spacer; /* make sure it is 8-byte-alligned on 32 bit pointer systems */ +}; + +union cachewrap { + char *cache; + struct entry *cache_a; + struct entry_l *cache_l; +}; + /* for array implementation */ struct entry { uint64_t val; @@ -38,7 +50,7 @@ struct entry { /* for linked list implementation */ struct entry_l { struct entry; - int64_t next; /* """pointer""" to the next element. */ + union nextoff; }; enum opmode { @@ -73,11 +85,10 @@ struct stream { char *name; size_t stride; size_t index; - struct entry_l *cnode; - char *cache; + struct entry_l *pnode; /* "previous" node */ + struct entry_l *cnode; /* "current" node */ + union cachewrap; struct settings *settings; - struct entry *cache_a; - struct entry_l *cache_l; struct entry_l *(*get_next_element_direct)(struct stream * const); struct entry_l *(*get_next_element_cache)(struct stream * const); int (*place_next_element_direct)(struct stream * const, struct entry_l const * const); -- cgit v1.2.3