Replaced attr-list arenas with three independent arrays
lfsr_attr_t attrs[a*d*b]; => lfsr_attr_t attrs[a];
lfs_size_t attr_count; lfs_size_t attr_count;
lfs_size_t attr_scratch; lfsr_data_t datas[d];
lfs_size_t data_count;
uint8_t buf[b];
lfs_size_t buf_size;
This mostly reverts the allocator scaffolding needed for the attr-list
arenas (LFS_ALIGNOF, etc). This is the main draw of this change, as it
would be nice to avoid a low-level arena implementation headaches unless
they prove to be worthwhile. Which they haven't really so far...
Unfortunately this comes with another code cost, I think due to the
number of counters needed to keep track of separate attr/data/buf
allocations. At least stack showed a slight improvement:
code stack
before: 33844 2824
after: 33872 (+0.1%) 2816 (-0.3%)
This commit is contained in:
-10
@@ -221,16 +221,6 @@ static inline void lfs_sswap32(int32_t *a, int32_t *b) {
|
||||
*b = t;
|
||||
}
|
||||
|
||||
// Find alignment of a type at compile time
|
||||
#if !defined(LFS_NO_INTRINSICS)
|
||||
#define LFS_ALIGNOF(t) __alignof__(t)
|
||||
#else
|
||||
#define LFS_ALIGNOF(t) ((size_t)&((struct {char a; t b;}*)0)->b)
|
||||
#endif
|
||||
|
||||
// Find size necessary to align type at compile time
|
||||
#define LFS_ALIGNEDSIZEOF(t) (sizeof(t) + LFS_ALIGNOF(t)-1)
|
||||
|
||||
// Align to nearest multiple of a size
|
||||
static inline uint32_t lfs_aligndown(uint32_t a, uint32_t alignment) {
|
||||
return a - (a % alignment);
|
||||
|
||||
Reference in New Issue
Block a user