From b76026f4db5dc357fe67210abdf606008e33961e Mon Sep 17 00:00:00 2001 From: Mathis Rosenhauer Date: Tue, 21 Jan 2025 13:59:33 +0100 Subject: [PATCH] Remove restrict keyword --- configure.ac | 1 - src/encode.c | 8 ++++---- src/encode_accessors.c | 44 +++++++++++++++++++++--------------------- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/configure.ac b/configure.ac index 1410a65..ccc6a0d 100644 --- a/configure.ac +++ b/configure.ac @@ -30,7 +30,6 @@ AC_TYPE_UINT32_T AC_TYPE_UINT64_T AC_TYPE_UINT8_T AC_C_INLINE -AC_C_RESTRICT AC_CHECK_FUNCS([memset strstr snprintf]) AC_CHECK_DECLS(__builtin_clzll) diff --git a/src/encode.c b/src/encode.c index 9c2d754..c6fb7f7 100644 --- a/src/encode.c +++ b/src/encode.c @@ -226,8 +226,8 @@ static void preprocess_unsigned(struct aec_stream *strm) uint32_t D; struct internal_state *state = strm->state; - const uint32_t *restrict x = state->data_raw; - uint32_t *restrict d = state->data_pp; + const uint32_t *x = state->data_raw; + uint32_t *d = state->data_pp; uint32_t xmax = state->xmax; uint32_t rsi = strm->rsi * strm->block_size - 1; @@ -260,8 +260,8 @@ static void preprocess_signed(struct aec_stream *strm) uint32_t D; struct internal_state *state = strm->state; - uint32_t *restrict x = state->data_raw; - uint32_t *restrict d = state->data_pp; + uint32_t *x = state->data_raw; + uint32_t *d = state->data_pp; uint32_t xmax = state->xmax; uint32_t xmin = state->xmin; uint32_t rsi = strm->rsi * strm->block_size - 1; diff --git a/src/encode_accessors.c b/src/encode_accessors.c index 07e1ffd..c055166 100644 --- a/src/encode_accessors.c +++ b/src/encode_accessors.c @@ -116,9 +116,9 @@ uint32_t aec_get_msb_32(struct aec_stream *strm) void aec_get_rsi_8(struct aec_stream *strm) { - uint32_t *restrict out = strm->state->data_raw; - unsigned const char *restrict in = strm->next_in; - int rsi = strm->rsi * strm->block_size; + uint32_t *out = strm->state->data_raw; + unsigned const char *in = strm->next_in; + int rsi = strm->rsi *strm->block_size; for (int i = 0; i < rsi; i++) out[i] = (uint32_t)in[i]; @@ -129,9 +129,9 @@ void aec_get_rsi_8(struct aec_stream *strm) void aec_get_rsi_lsb_16(struct aec_stream *strm) { - uint32_t *restrict out = strm->state->data_raw; - const unsigned char *restrict in = strm->next_in; - int rsi = strm->rsi * strm->block_size; + uint32_t *out = strm->state->data_raw; + const unsigned char *in = strm->next_in; + int rsi = strm->rsi *strm->block_size; for (int i = 0; i < rsi; i++) out[i] = (uint32_t)in[2 * i] | ((uint32_t)in[2 * i + 1] << 8); @@ -142,9 +142,9 @@ void aec_get_rsi_lsb_16(struct aec_stream *strm) void aec_get_rsi_msb_16(struct aec_stream *strm) { - uint32_t *restrict out = strm->state->data_raw; - const unsigned char *restrict in = strm->next_in; - int rsi = strm->rsi * strm->block_size; + uint32_t *out = strm->state->data_raw; + const unsigned char *in = strm->next_in; + int rsi = strm->rsi *strm->block_size; for (int i = 0; i < rsi; i++) out[i] = ((uint32_t)in[2 * i] << 8) | (uint32_t)in[2 * i + 1]; @@ -155,9 +155,9 @@ void aec_get_rsi_msb_16(struct aec_stream *strm) void aec_get_rsi_lsb_24(struct aec_stream *strm) { - uint32_t *restrict out = strm->state->data_raw; - const unsigned char *restrict in = strm->next_in; - int rsi = strm->rsi * strm->block_size; + uint32_t *out = strm->state->data_raw; + const unsigned char *in = strm->next_in; + int rsi = strm->rsi *strm->block_size; for (int i = 0; i < rsi; i++) out[i] = (uint32_t)in[3 * i] @@ -170,9 +170,9 @@ void aec_get_rsi_lsb_24(struct aec_stream *strm) void aec_get_rsi_msb_24(struct aec_stream *strm) { - uint32_t *restrict out = strm->state->data_raw; - const unsigned char *restrict in = strm->next_in; - int rsi = strm->rsi * strm->block_size; + uint32_t *out = strm->state->data_raw; + const unsigned char *in = strm->next_in; + int rsi = strm->rsi *strm->block_size; for (int i = 0; i < rsi; i++) out[i] = ((uint32_t)in[3 * i] << 16) @@ -186,7 +186,7 @@ void aec_get_rsi_msb_24(struct aec_stream *strm) #define AEC_GET_RSI_NATIVE_32(BO) \ void aec_get_rsi_##BO##_32(struct aec_stream *strm) \ { \ - int rsi = strm->rsi * strm->block_size; \ + int rsi = strm->rsi *strm->block_size; \ memcpy(strm->state->data_raw, \ strm->next_in, 4 * rsi); \ strm->next_in += 4 * rsi; \ @@ -196,9 +196,9 @@ void aec_get_rsi_msb_24(struct aec_stream *strm) #ifdef WORDS_BIGENDIAN void aec_get_rsi_lsb_32(struct aec_stream *strm) { - uint32_t *restrict out = strm->state->data_raw; - const unsigned char *restrict in = strm->next_in; - int rsi = strm->rsi * strm->block_size; + uint32_t *out = strm->state->data_raw; + const unsigned char *in = strm->next_in; + int rsi = strm->rsi *strm->block_size; for (int i = 0; i < rsi; i++) out[i] = (uint32_t)in[4 * i] @@ -215,9 +215,9 @@ AEC_GET_RSI_NATIVE_32(msb); #else /* !WORDS_BIGENDIAN */ void aec_get_rsi_msb_32(struct aec_stream *strm) { - uint32_t *restrict out = strm->state->data_raw; - const unsigned char *restrict in = strm->next_in; - int rsi = strm->rsi * strm->block_size; + uint32_t *out = strm->state->data_raw; + const unsigned char *in = strm->next_in; + int rsi = strm->rsi *strm->block_size; strm->next_in += 4 * rsi; strm->avail_in -= 4 * rsi;