Skip to content

Commit

Permalink
Remove restrict keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
MathisRosenhauer committed Jan 21, 2025
1 parent d620653 commit b76026f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 27 deletions.
1 change: 0 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions src/encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
44 changes: 22 additions & 22 deletions src/encode_accessors.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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);
Expand All @@ -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];
Expand All @@ -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]
Expand All @@ -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)
Expand All @@ -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; \
Expand All @@ -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]
Expand All @@ -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;
Expand Down

0 comments on commit b76026f

Please sign in to comment.