matchfinder: add MATCHFINDER_ALIGNED macro

Avoid some code duplication.
This commit is contained in:
Eric Biggers 2022-01-01 19:49:14 -06:00
parent 52b61d98d8
commit 41685b0dac
3 changed files with 5 additions and 10 deletions

View File

@ -99,11 +99,7 @@ struct bt_matchfinder {
* 'child_tab[pos * 2]' and 'child_tab[pos * 2 + 1]', respectively. */
mf_pos_t child_tab[2UL * MATCHFINDER_WINDOW_SIZE];
}
#ifdef _aligned_attribute
_aligned_attribute(MATCHFINDER_MEM_ALIGNMENT)
#endif
;
} MATCHFINDER_ALIGNED;
/* Prepare the matchfinder for a new input buffer. */
static forceinline void

View File

@ -129,11 +129,7 @@ struct hc_matchfinder {
* the node for the sequence with position 'pos' is 'next_tab[pos]'. */
mf_pos_t next_tab[MATCHFINDER_WINDOW_SIZE];
}
#ifdef _aligned_attribute
_aligned_attribute(MATCHFINDER_MEM_ALIGNMENT)
#endif
;
} MATCHFINDER_ALIGNED;
/* Prepare the matchfinder for a new input buffer. */
static forceinline void

View File

@ -28,11 +28,14 @@ typedef s16 mf_pos_t;
#undef matchfinder_init
#undef matchfinder_rebase
#ifdef _aligned_attribute
# define MATCHFINDER_ALIGNED _aligned_attribute(MATCHFINDER_MEM_ALIGNMENT)
# if defined(__arm__) || defined(__aarch64__)
# include "arm/matchfinder_impl.h"
# elif defined(__i386__) || defined(__x86_64__)
# include "x86/matchfinder_impl.h"
# endif
#else
# define MATCHFINDER_ALIGNED
#endif
/*