Commit a6e11e70 authored by Vaibhav Shrivastava's avatar Vaibhav Shrivastava Committed by Laurent THOMAS

Fix review comments of cppcheck warnings related to nullPointerArithmeticRedundantCheck

parent efc5ce39
......@@ -1039,8 +1039,6 @@ static uint32_t get_packed_msg_len(uintptr_t msgHead, uintptr_t msgEnd) {
int nfapi_nr_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t *config) {
nfapi_p4_p5_message_header_t *pMessageHeader = pMessageBuf;
uint8_t *pWritePackedMessage = pPackedBuf;
uint8_t *pPackMessageEnd = (pWritePackedMessage == NULL) ? NULL : pPackedBuf + packedBufLen;
uint8_t *pPackedLengthField = (pWritePackedMessage == NULL) ? NULL : &pWritePackedMessage[4];
uint32_t packedMsgLen;
uint16_t packedMsgLen16;
......@@ -1049,6 +1047,9 @@ int nfapi_nr_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pP
return -1;
}
uint8_t *pPackMessageEnd = pPackedBuf + packedBufLen;
uint8_t *pPackedLengthField = &pWritePackedMessage[4];
// pack the message
if(push16(pMessageHeader->phy_id, &pWritePackedMessage, pPackMessageEnd) &&
push16(pMessageHeader->message_id, &pWritePackedMessage, pPackMessageEnd) &&
......
......@@ -89,8 +89,7 @@ void rotate_cpx_vector(const c16_t *const x, const c16_t *const alpha, c16_t *y,
// stores result in y
// N is the number of complex numbers
// output_shift reduces the result of the multiplication by this number of bits
//AssertFatal(N%8==0, "To be developped");
if ( (intptr_t)x%32 == 0 && !(intptr_t)y%32 == 0 && __builtin_cpu_supports("avx2")) {
if ( __builtin_cpu_supports("avx2")) {
// output is 32 bytes aligned, but not the input
const c16_t for_re={alpha->r, -alpha->i};
......@@ -132,17 +131,17 @@ void rotate_cpx_vector(const c16_t *const x, const c16_t *const alpha, c16_t *y,
__m256i* xd= (__m256i*)x;
const __m256i *end=xd+N/8;
for( __m256i* yd = (__m256i *)y; xd<end ; yd++, xd++) {
const __m256i xre = simde_mm256_srai_epi32(simde_mm256_madd_epi16(*xd,alpha_for_real),
const __m256i y256= _mm256_lddqu_si256(xd);
const __m256i xre = simde_mm256_srai_epi32(simde_mm256_madd_epi16(y256,alpha_for_real),
output_shift);
const __m256i xim = simde_mm256_srai_epi32(simde_mm256_madd_epi16(*xd,alpha_for_im),
const __m256i xim = simde_mm256_srai_epi32(simde_mm256_madd_epi16(y256,alpha_for_im),
output_shift);
// a bit faster than unpacklo+unpackhi+packs
const __m256i tmp=simde_mm256_packs_epi32(xre,xim);
*yd=simde_mm256_shuffle_epi8(tmp,perm_mask);
_mm256_storeu_si256(yd,simde_mm256_shuffle_epi8(tmp,perm_mask));
}
c16_t* alpha16=(c16_t*) alpha, *yLast;
if (y != NULL)
yLast = ((c16_t *)y) + (N / 8) * 8;
yLast=((c16_t*)y)+(N/8)*8;
for (c16_t* xTail=(c16_t*) end;
xTail<((c16_t*) x)+N;
xTail++, yLast++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment