Re: [PATCH 1/5] lib/sort: Make swap functions more generic
From: George Spelvin
Date: Thu Mar 14 2019 - 07:55:09 EST
On Thu, 14 Mar 2019 at 11:41:26 +0100, Geert Uytterhoeven wrote:
> On Thu, Mar 14, 2019 at 11:10 AM George Spelvin <lkml@xxxxxxx> wrote:
>> On Sat, 09 Mar 2019 at 23:19:49 +0300, Andrey Abramov wrote:
>>>> How about one of:
>>>> swap_bytes / swap_ints / swap_longs
>>>> swap_1 / swap_4 / swap_8
>>>
>>> longs are ambiguous, so I would prefer bit-sized types.
>>
>> I already implemented Andrey's suggestions, which were the exact
>> opposite of yours.
>>
>> Pistols at dawn?
I didn't explain the joke because jokes aren't funny if explained,
but just in case, by suggesting a clearly ridiculous method, I was
saying "I have no idea how to resolve this conflict."
> Prepared to fix all future long vs. int bugs?
In the entire kernel? Or just the one small source file
where these statically scoped helper functions are visible?
In case of uncertainty, the comments and the code are right there
just a few lines away from the one and only call site, so I
don't expect much confusion.
I care a lot about function names when they are exported, but in
this case we're talking about what colour to paint the *inside* of
the bike shed.
I just want to pick some names and move on. Since nothing so far seems
satsify everyone, I'll go with the ponderous but utterly unambiguous:
swap_bytes
swap_4byte_words
swap_8byte_words