[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZIg+/KqNgDPx5GKo@corigine.com>
Date: Tue, 13 Jun 2023 12:03:40 +0200
From: Simon Horman <simon.horman@...igine.com>
To: Hao Lan <lanhao@...wei.com>
Cc: netdev@...r.kernel.org, yisen.zhuang@...wei.com, salil.mehta@...wei.com,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, richardcochran@...il.com,
wangpeiyang1@...wei.com, shenjian15@...wei.com,
chenhao418@...wei.com, wangjie125@...wei.com, yuanjilin@...rlc.com,
cai.huoqing@...ux.dev, xiujianfeng@...wei.com
Subject: Re: [PATCH net-next v2 1/4] net: hns3: refine the tcam key convert
handle
On Mon, Jun 12, 2023 at 08:23:55PM +0800, Hao Lan wrote:
> From: Jian Shen <shenjian15@...wei.com>
>
> The result of expression '(k ^ ~v) & k' is exactly
> the same with 'k & v', so simplify it.
> (k ^ ~v) & k == k & v
> The truth table (in non table form):
> k == 0, v == 0:
> (k ^ ~v) & k == (0 ^ ~0) & 0 == (0 ^ 1) & 0 == 1 & 0 == 0
> k & v == 0 & 0 == 0
>
> k == 0, v == 1:
> (k ^ ~v) & k == (0 ^ ~1) & 0 == (0 ^ 0) & 0 == 1 & 0 == 0
> k & v == 0 & 1 == 0
>
> k == 1, v == 0:
> (k ^ ~v) & k == (1 ^ ~0) & 1 == (1 ^ 1) & 1 == 0 & 1 == 0
> k & v == 1 & 0 == 0
>
> k == 1, v == 1:
> (k ^ ~v) & k == (1 ^ ~1) & 1 == (1 ^ 0) & 1 == 1 & 1 == 1
> k & v == 1 & 1 == 1
>
> ChangeLog:
> v1->v2:
> Fixed the comment description error and added
> the truth table in the comment.
> suggested by Simon Horman.
>
> Signed-off-by: Jian Shen <shenjian15@...wei.com>
> Signed-off-by: Hao Lan <lanhao@...wei.com>
Reviewed-by: Simon Horman <simon.horman@...igine.com>
Powered by blists - more mailing lists