linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Marc Kleine-Budde <mkl@pengutronix.de>, linux-can@vger.kernel.org
Subject: Re: [PATCH 2/3] can: add hash based access to single EFF frame filters
Date: Wed, 02 Apr 2014 19:26:16 +0200	[thread overview]
Message-ID: <533C4838.2000908@hartkopp.net> (raw)
In-Reply-To: <533BE133.8020600@pengutronix.de>

On 02.04.2014 12:06, Marc Kleine-Budde wrote:

> 
> [1] After a long long long search I found a compiler (Debian clang
> version 3.4-2 (tags/RELEASE_34/final) (based on LLVM 3.4) in 32 Bit
> mode) that produces a function with more more instruction for your
> "backwards" hash compared to a "forward" hash:
> 
> 	hash = can_id;
> 	hash ^= can_id >> CAN_EFF_RCV_HASH_BITS;
> 	hash ^= can_id >> (2 * CAN_EFF_RCV_HASH_BITS);
> 
> 	return hash & ((1 << CAN_EFF_RCV_HASH_BITS) - 1);
> 
> In 64 bit mode it issues the same number of instructions, though your
> backwards hash is a byte shorter :) gcc 4.7 in contrast creates same
> number of instructions and bytes for 32 and 64 bit.
> 

Ok, I see you really had fun with this review :-)

Will change the hash function like this - and the other stuff too.

Thanks,
Oliver

  reply	other threads:[~2014-04-02 17:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-01 18:57 [PATCH 0/3] can: add support for hash based access to EFF frame filters Oliver Hartkopp
2014-04-01 18:57 ` [PATCH 1/3] can: proc: make array printing function indenpendent from sff frames Oliver Hartkopp
2014-04-02  7:16   ` Marc Kleine-Budde
2014-04-01 18:57 ` [PATCH 2/3] can: add hash based access to single EFF frame filters Oliver Hartkopp
2014-04-02 10:06   ` Marc Kleine-Budde
2014-04-02 17:26     ` Oliver Hartkopp [this message]
2014-04-01 18:57 ` [PATCH 3/3] can: add documentation for CAN filter usage optimisation Oliver Hartkopp

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=533C4838.2000908@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    /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).