[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <DM6PR11MB4657721B8CB36AEB67F1A8809B38A@DM6PR11MB4657.namprd11.prod.outlook.com>
Date: Tue, 18 Jul 2023 16:30:02 +0000
From: "Kubalewski, Arkadiusz" <arkadiusz.kubalewski@...el.com>
To: Jakub Kicinski <kuba@...nel.org>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"davem@...emloft.net" <davem@...emloft.net>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"chuck.lever@...cle.com" <chuck.lever@...cle.com>
Subject: RE: [PATCH net-next 1/2 v2] tools: ynl-gen: fix enum index in
_decode_enum(..)
>From: Jakub Kicinski <kuba@...nel.org>
>Sent: Thursday, July 13, 2023 6:03 PM
>
>On Thu, 13 Jul 2023 11:05:49 +0200 Arkadiusz Kubalewski wrote:
>> - i = attr_spec.get('value-start', 0)
>> if 'enum-as-flags' in attr_spec and attr_spec['enum-as-flags']:
>> value = set()
>> while raw:
>> if raw & 1:
>> - value.add(enum.entries_by_val[i].name)
>> + value.add(enum.entries_by_val[raw & 1].name)
>> raw >>= 1
>> - i += 1
>
>This doesn't make sense, as I suggested you need to keep i for this
>loop. Move it to the inside of the if 'enum-as-fla... and init to 0.
>
>i is tracking which bit number we are at as we consume / shift out
>bits from raw.
>
Yeah, you are right, I don't think I had clear mind when created those..
>Have you ever used ChatGPT? No shame, just curious.
I have used it, but I am not using it to prepare code, this was my fault,
chat would probably do better..
Anyway just sent v3 with this part fixed.
Thank you!
Arkadiusz
>--
>pw-bot: cr
Powered by blists - more mailing lists