diff options
author | 2021-02-15 09:18:31 +0200 | |
---|---|---|
committer | 2021-02-15 09:18:31 +0200 | |
commit | fb383b792d1044405188e42c4b827858c4a3a038 (patch) | |
tree | 706761232471d5e85d31daba26524db150544cd8 /src/defs.h | |
parent | 4a14ab7ab48e3fd591dde33d59c6d29fc39f1c5d (diff) | |
download | algos-ld1-fb383b792d1044405188e42c4b827858c4a3a038.tar.gz algos-ld1-fb383b792d1044405188e42c4b827858c4a3a038.tar.bz2 algos-ld1-fb383b792d1044405188e42c4b827858c4a3a038.zip |
now with generating lists!
Signed-off-by: Gediminas Jakutis <gediminas@varciai.lt>
Diffstat (limited to 'src/defs.h')
-rw-r--r-- | src/defs.h | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -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); |