dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
From: Pawel Wodkowski <pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Yerden Zhumabekov <e_zhumabekov-8EHiFRVJVgQ@public.gmane.org>,
	dev-VfR2kkLFssw@public.gmane.org
Subject: Re: [PATCH] hash: fix breaking strict-aliasing rules
Date: Fri, 20 Mar 2015 13:47:55 +0100	[thread overview]
Message-ID: <550C16FB.5050808@intel.com> (raw)
In-Reply-To: <b441d020bd7830b1c66b6f4d2aa8d776a7f0bffd.1426697208.git.e_zhumabekov-8EHiFRVJVgQ@public.gmane.org>

On 2015-03-18 17:51, Yerden Zhumabekov wrote:

>
> -	switch (7 - (data_len & 0x07)) {
> +	i = 7 - (data_len & 0x07);
> +	switch (i) {
>   	case 0:
> -		temp |= (uint64_t) *((const uint8_t *)p64 + 6) << 48;
> -		/* Fallthrough */
>   	case 1:
> -		temp |= (uint64_t) *((const uint8_t *)p64 + 5) << 40;
> -		/* Fallthrough */
>   	case 2:
> -		temp |= (uint64_t) *((const uint8_t *)p64 + 4) << 32;
> -		temp |= *((const uint32_t *)p64);
> +		temp = odd_8byte_mask[i] & *p64;
>   		init_val = rte_hash_crc_8byte(temp, init_val);
>   		break;
>   	case 3:
> -		init_val = rte_hash_crc_4byte(*(const uint32_t *)p64, init_val);
> -		break;
>   	case 4:
> -		temp |= *((const uint8_t *)p64 + 2) << 16;
> -		/* Fallthrough */
>   	case 5:
> -		temp |= *((const uint8_t *)p64 + 1) << 8;
> -		/* Fallthrough */
>   	case 6:
> -		temp |= *((const uint8_t *)p64);
> +		temp = odd_8byte_mask[i] & *p64;
>   		init_val = rte_hash_crc_4byte(temp, init_val);
> -		/* Fallthrough */
>   	default:
>   		break;
>   	}
>

Second thought: is this not an issue here reading 8 bytes by 
dereferencing *p64 if there is less bytes in buffer?

-- 
Pawel

  parent reply	other threads:[~2015-03-20 12:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-18 16:51 [PATCH] hash: fix breaking strict-aliasing rules Yerden Zhumabekov
     [not found] ` <b441d020bd7830b1c66b6f4d2aa8d776a7f0bffd.1426697208.git.e_zhumabekov-8EHiFRVJVgQ@public.gmane.org>
2015-03-19 16:25   ` Bruce Richardson
2015-03-19 16:31     ` Bruce Richardson
2015-03-20  3:29       ` Yerden Zhumabekov
2015-03-20 12:41   ` Pawel Wodkowski
2015-03-20 12:47   ` Pawel Wodkowski [this message]
     [not found]     ` <550C16FB.5050808-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-03-21  6:57       ` Жумабеков Ерден Мирзагулович
2015-03-24 13:31   ` [PATCH v2] " Yerden Zhumabekov
     [not found]     ` <3ba2a35fc1c2e9e3058d678908e2245d88bd7743.1427203852.git.e_zhumabekov-8EHiFRVJVgQ@public.gmane.org>
2015-03-26 17:47       ` De Lara Guarch, Pablo
     [not found]         ` <E115CCD9D858EF4F90C690B0DCB4D8972727C999-kPTMFJFq+rEMvF1YICWikbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-27  9:26           ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=550C16FB.5050808@intel.com \
    --to=pawelx.wodkowski-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    --cc=e_zhumabekov-8EHiFRVJVgQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).