Use sizeof(uint32_t) to avoid warning in GCC7.

error: 'memset' used with length equal to number of elements without multiplication by element size [-Werror=memset-elt-size]
This commit is contained in:
Ari Lemmetti 2017-04-03 19:16:09 +03:00
parent a3acd01a20
commit e3c3e74926

View file

@ -557,11 +557,13 @@ void kvz_rdoq(encoder_state_t * const state, coeff_t *coef, coeff_t *dest_coeff,
// Explicitly tell the only possible numbers of elements to be zeroed.
// Hope the compiler is able to utilize this information.
// TODO: Make sure this works if someone changes type of sig_coeffgoup_flag.
// Also check that eg. GCC7 does not warn about not multiplying by element size.
switch (cg_num) {
case 1: memset(sig_coeffgroup_flag, 0, 1 * sizeof(sig_coeffgroup_flag[0])); break;
case 4: memset(sig_coeffgroup_flag, 0, 4 * sizeof(sig_coeffgroup_flag[0])); break;
case 16: memset(sig_coeffgroup_flag, 0, 16 * sizeof(sig_coeffgroup_flag[0])); break;
case 64: memset(sig_coeffgroup_flag, 0, 64 * sizeof(sig_coeffgroup_flag[0])); break;
case 1: memset(sig_coeffgroup_flag, 0, 1 * sizeof(uint32_t)); break;
case 4: memset(sig_coeffgroup_flag, 0, 4 * sizeof(uint32_t)); break;
case 16: memset(sig_coeffgroup_flag, 0, 16 * sizeof(uint32_t)); break;
case 64: memset(sig_coeffgroup_flag, 0, 64 * sizeof(uint32_t)); break;
default: assert(0 && "There should be 1, 4, 16 or 64 coefficient groups");
}