Skip to content

Commit

Permalink
Rename functions to get rid of old and now misleading "unaligned" naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Dead2 committed Dec 26, 2024
1 parent d7e121e commit 1aeb291
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 57 deletions.
42 changes: 21 additions & 21 deletions arch/generic/compare256_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Z_INTERNAL uint32_t compare256_c(const uint8_t *src0, const uint8_t *src1) {
#if OPTIMAL_CMP >= 32

/* 16-bit unaligned integer comparison */
static inline uint32_t compare256_unaligned_16_static(const uint8_t *src0, const uint8_t *src1) {
static inline uint32_t compare256_16_static(const uint8_t *src0, const uint8_t *src1) {
uint32_t len = 0;

do {
Expand All @@ -84,24 +84,24 @@ static inline uint32_t compare256_unaligned_16_static(const uint8_t *src0, const
return 256;
}

Z_INTERNAL uint32_t compare256_unaligned_16(const uint8_t *src0, const uint8_t *src1) {
return compare256_unaligned_16_static(src0, src1);
Z_INTERNAL uint32_t compare256_16(const uint8_t *src0, const uint8_t *src1) {
return compare256_16_static(src0, src1);
}

#define LONGEST_MATCH longest_match_unaligned_16
#define COMPARE256 compare256_unaligned_16_static
#define LONGEST_MATCH longest_match_16
#define COMPARE256 compare256_16_static

#include "match_tpl.h"

#define LONGEST_MATCH_SLOW
#define LONGEST_MATCH longest_match_slow_unaligned_16
#define COMPARE256 compare256_unaligned_16_static
#define LONGEST_MATCH longest_match_slow_16
#define COMPARE256 compare256_16_static

#include "match_tpl.h"

#ifdef HAVE_BUILTIN_CTZ
/* 32-bit unaligned integer comparison */
static inline uint32_t compare256_unaligned_32_static(const uint8_t *src0, const uint8_t *src1) {
static inline uint32_t compare256_32_static(const uint8_t *src0, const uint8_t *src1) {
uint32_t len = 0;

do {
Expand All @@ -126,26 +126,26 @@ static inline uint32_t compare256_unaligned_32_static(const uint8_t *src0, const
return 256;
}

Z_INTERNAL uint32_t compare256_unaligned_32(const uint8_t *src0, const uint8_t *src1) {
return compare256_unaligned_32_static(src0, src1);
Z_INTERNAL uint32_t compare256_32(const uint8_t *src0, const uint8_t *src1) {
return compare256_32_static(src0, src1);
}

#define LONGEST_MATCH longest_match_unaligned_32
#define COMPARE256 compare256_unaligned_32_static
#define LONGEST_MATCH longest_match_32
#define COMPARE256 compare256_32_static

#include "match_tpl.h"

#define LONGEST_MATCH_SLOW
#define LONGEST_MATCH longest_match_slow_unaligned_32
#define COMPARE256 compare256_unaligned_32_static
#define LONGEST_MATCH longest_match_slow_32
#define COMPARE256 compare256_32_static

#include "match_tpl.h"

#endif

#if defined(HAVE_BUILTIN_CTZLL) && OPTIMAL_CMP >= 64
/* 64-bit integer comparison */
static inline uint32_t compare256_unaligned_64_static(const uint8_t *src0, const uint8_t *src1) {
static inline uint32_t compare256_64_static(const uint8_t *src0, const uint8_t *src1) {
uint32_t len = 0;

do {
Expand All @@ -170,18 +170,18 @@ static inline uint32_t compare256_unaligned_64_static(const uint8_t *src0, const
return 256;
}

Z_INTERNAL uint32_t compare256_unaligned_64(const uint8_t *src0, const uint8_t *src1) {
return compare256_unaligned_64_static(src0, src1);
Z_INTERNAL uint32_t compare256_64(const uint8_t *src0, const uint8_t *src1) {
return compare256_64_static(src0, src1);
}

#define LONGEST_MATCH longest_match_unaligned_64
#define COMPARE256 compare256_unaligned_64_static
#define LONGEST_MATCH longest_match_64
#define COMPARE256 compare256_64_static

#include "match_tpl.h"

#define LONGEST_MATCH_SLOW
#define LONGEST_MATCH longest_match_slow_unaligned_64
#define COMPARE256 compare256_unaligned_64_static
#define LONGEST_MATCH longest_match_slow_64
#define COMPARE256 compare256_64_static

#include "match_tpl.h"

Expand Down
36 changes: 18 additions & 18 deletions arch/generic/generic_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ uint32_t PREFIX(crc32_braid)(uint32_t crc, const uint8_t *buf, size_t len);

uint32_t compare256_c(const uint8_t *src0, const uint8_t *src1);
#if OPTIMAL_CMP >= 32
uint32_t compare256_unaligned_16(const uint8_t *src0, const uint8_t *src1);
uint32_t compare256_16(const uint8_t *src0, const uint8_t *src1);
# ifdef HAVE_BUILTIN_CTZ
uint32_t compare256_unaligned_32(const uint8_t *src0, const uint8_t *src1);
uint32_t compare256_32(const uint8_t *src0, const uint8_t *src1);
# endif
# if defined(HAVE_BUILTIN_CTZLL) && OPTIMAL_CMP >= 64
uint32_t compare256_unaligned_64(const uint8_t *src0, const uint8_t *src1);
uint32_t compare256_64(const uint8_t *src0, const uint8_t *src1);
# endif
#endif

Expand All @@ -45,33 +45,33 @@ void slide_hash_c(deflate_state *s);
uint32_t longest_match_c(deflate_state *const s, Pos cur_match);
uint32_t longest_match_slow_c(deflate_state *const s, Pos cur_match);
#if OPTIMAL_CMP >= 32
uint32_t longest_match_unaligned_16(deflate_state *const s, Pos cur_match);
uint32_t longest_match_slow_unaligned_16(deflate_state *const s, Pos cur_match);
uint32_t longest_match_16(deflate_state *const s, Pos cur_match);
uint32_t longest_match_slow_16(deflate_state *const s, Pos cur_match);
# ifdef HAVE_BUILTIN_CTZ
uint32_t longest_match_unaligned_32(deflate_state *const s, Pos cur_match);
uint32_t longest_match_slow_unaligned_32(deflate_state *const s, Pos cur_match);
uint32_t longest_match_32(deflate_state *const s, Pos cur_match);
uint32_t longest_match_slow_32(deflate_state *const s, Pos cur_match);
# endif
# if defined(HAVE_BUILTIN_CTZLL) && OPTIMAL_CMP >= 64
uint32_t longest_match_unaligned_64(deflate_state *const s, Pos cur_match);
uint32_t longest_match_slow_unaligned_64(deflate_state *const s, Pos cur_match);
uint32_t longest_match_64(deflate_state *const s, Pos cur_match);
uint32_t longest_match_slow_64(deflate_state *const s, Pos cur_match);
# endif
#endif


// Select generic implementation for longest_match, longest_match_slow, longest_match_slow functions.
#if OPTIMAL_CMP >= 32
# if defined(HAVE_BUILTIN_CTZLL) && OPTIMAL_CMP >= 64
# define longest_match_generic longest_match_unaligned_64
# define longest_match_slow_generic longest_match_slow_unaligned_64
# define compare256_generic compare256_unaligned_64
# define longest_match_generic longest_match_64
# define longest_match_slow_generic longest_match_slow_64
# define compare256_generic compare256_64
# elif defined(HAVE_BUILTIN_CTZ)
# define longest_match_generic longest_match_unaligned_32
# define longest_match_slow_generic longest_match_slow_unaligned_32
# define compare256_generic compare256_unaligned_32
# define longest_match_generic longest_match_32
# define longest_match_slow_generic longest_match_slow_32
# define compare256_generic compare256_32
# else
# define longest_match_generic longest_match_unaligned_16
# define longest_match_slow_generic longest_match_slow_unaligned_16
# define compare256_generic compare256_unaligned_16
# define longest_match_generic longest_match_16
# define longest_match_slow_generic longest_match_slow_16
# define compare256_generic compare256_16
# endif
#else
# define longest_match_generic longest_match_c
Expand Down
6 changes: 3 additions & 3 deletions compare256_rle.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static inline uint32_t compare256_rle_c(const uint8_t *src0, const uint8_t *src1

#if OPTIMAL_CMP >= 32
/* 16-bit unaligned integer comparison */
static inline uint32_t compare256_rle_unaligned_16(const uint8_t *src0, const uint8_t *src1) {
static inline uint32_t compare256_rle_16(const uint8_t *src0, const uint8_t *src1) {
uint32_t len = 0;
uint16_t src0_cmp;

Expand All @@ -72,7 +72,7 @@ static inline uint32_t compare256_rle_unaligned_16(const uint8_t *src0, const ui

#ifdef HAVE_BUILTIN_CTZ
/* 32-bit unaligned integer comparison */
static inline uint32_t compare256_rle_unaligned_32(const uint8_t *src0, const uint8_t *src1) {
static inline uint32_t compare256_rle_32(const uint8_t *src0, const uint8_t *src1) {
uint32_t sv, len = 0;
uint16_t src0_cmp;

Expand Down Expand Up @@ -104,7 +104,7 @@ static inline uint32_t compare256_rle_unaligned_32(const uint8_t *src0, const ui

#if defined(HAVE_BUILTIN_CTZLL) && OPTIMAL_CMP >= 64
/* 64-bit unaligned integer comparison */
static inline uint32_t compare256_rle_unaligned_64(const uint8_t *src0, const uint8_t *src1) {
static inline uint32_t compare256_rle_64(const uint8_t *src0, const uint8_t *src1) {
uint32_t src0_cmp32, len = 0;
uint16_t src0_cmp;
uint64_t sv;
Expand Down
6 changes: 3 additions & 3 deletions deflate_rle.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@

#if OPTIMAL_CMP >= 32
# if defined(HAVE_BUILTIN_CTZLL) && OPTIMAL_CMP >= 64
# define compare256_rle compare256_rle_unaligned_64
# define compare256_rle compare256_rle_64
# elif defined(HAVE_BUILTIN_CTZ)
# define compare256_rle compare256_rle_unaligned_32
# define compare256_rle compare256_rle_32
# else
# define compare256_rle compare256_rle_unaligned_16
# define compare256_rle compare256_rle_16
# endif
#else
# define compare256_rle compare256_rle_c
Expand Down
6 changes: 3 additions & 3 deletions test/benchmarks/benchmark_compare256.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ BENCHMARK_COMPARE256(native, native_compare256, 1);
#else

#if BYTE_ORDER == LITTLE_ENDIAN && OPTIMAL_CMP >= 32
BENCHMARK_COMPARE256(unaligned_16, compare256_unaligned_16, 1);
BENCHMARK_COMPARE256(16, compare256_16, 1);
# if defined(HAVE_BUILTIN_CTZ)
BENCHMARK_COMPARE256(unaligned_32, compare256_unaligned_32, 1);
BENCHMARK_COMPARE256(32, compare256_32, 1);
# endif
# if defined(HAVE_BUILTIN_CTZLL) && OPTIMAL_CMP >= 64
BENCHMARK_COMPARE256(unaligned_64, compare256_unaligned_64, 1);
BENCHMARK_COMPARE256(64, compare256_64, 1);
# endif
#endif
#if defined(X86_SSE2) && defined(HAVE_BUILTIN_CTZ)
Expand Down
6 changes: 3 additions & 3 deletions test/benchmarks/benchmark_compare256_rle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ class compare256_rle: public benchmark::Fixture {
BENCHMARK_COMPARE256_RLE(c, compare256_rle_c, 1);

#if BYTE_ORDER == LITTLE_ENDIAN && OPTIMAL_CMP >= 32
BENCHMARK_COMPARE256_RLE(unaligned_16, compare256_rle_unaligned_16, 1);
BENCHMARK_COMPARE256_RLE(16, compare256_rle_16, 1);
# if defined(HAVE_BUILTIN_CTZ)
BENCHMARK_COMPARE256_RLE(unaligned_32, compare256_rle_unaligned_32, 1);
BENCHMARK_COMPARE256_RLE(32, compare256_rle_32, 1);
# endif
# if defined(HAVE_BUILTIN_CTZLL) && OPTIMAL_CMP >= 64
BENCHMARK_COMPARE256_RLE(unaligned_64, compare256_rle_unaligned_64, 1);
BENCHMARK_COMPARE256_RLE(64, compare256_rle_64, 1);
# endif
#endif
6 changes: 3 additions & 3 deletions test/test_compare256.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ TEST_COMPARE256(native, native_compare256, 1)
#else

#if BYTE_ORDER == LITTLE_ENDIAN && OPTIMAL_CMP >= 32
TEST_COMPARE256(unaligned_16, compare256_unaligned_16, 1)
TEST_COMPARE256(16, compare256_16, 1)
# if defined(HAVE_BUILTIN_CTZ)
TEST_COMPARE256(unaligned_32, compare256_unaligned_32, 1)
TEST_COMPARE256(32, compare256_32, 1)
# endif
# if defined(HAVE_BUILTIN_CTZLL) && OPTIMAL_CMP >= 64
TEST_COMPARE256(unaligned_64, compare256_unaligned_64, 1)
TEST_COMPARE256(64, compare256_64, 1)
# endif
#endif

Expand Down
6 changes: 3 additions & 3 deletions test/test_compare256_rle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ static inline void compare256_rle_match_check(compare256_rle_func compare256_rle
TEST_COMPARE256_RLE(c, compare256_rle_c, 1)

#if BYTE_ORDER == LITTLE_ENDIAN && OPTIMAL_CMP >= 32
TEST_COMPARE256_RLE(unaligned_16, compare256_rle_unaligned_16, 1)
TEST_COMPARE256_RLE(16, compare256_rle_16, 1)
# if defined(HAVE_BUILTIN_CTZ)
TEST_COMPARE256_RLE(unaligned_32, compare256_rle_unaligned_32, 1)
TEST_COMPARE256_RLE(32, compare256_rle_32, 1)
# endif
# if defined(HAVE_BUILTIN_CTZLL) && OPTIMAL_CMP >= 64
TEST_COMPARE256_RLE(unaligned_64, compare256_rle_unaligned_64, 1)
TEST_COMPARE256_RLE(64, compare256_rle_64, 1)
# endif
#endif

0 comments on commit 1aeb291

Please sign in to comment.