lkml.org 
[lkml]   [2015]   [May]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] block: Use BIT macro from include/linux/bitops.h
From
On 21 May 2015 at 01:13, Jens Axboe <axboe@kernel.dk> wrote:
> On 05/20/2015 01:41 PM, Jagan Teki wrote:
>>
>> On 21 May 2015 at 00:52, Jens Axboe <axboe@kernel.dk> wrote:
>>>
>>> On 05/18/2015 01:14 PM, Jagan Teki wrote:
>>>>
>>>>
>>>> Replace (1 << nr) to BIT(nr) where nr = 0, 1, 2 .... 31
>>>
>>>
>>>
>>> I don't like it, I think it hurts readability.
>>
>>
>> What do you mean by don't like, using kernel defined macro instead of
>> numerical assignments huts readability?
>
>
> In the context of the patch, BIT(0) == (1 << 0) is obvious. But if I just
> came across BIT(7) in the code, I'd have to check, whereas anyone would
> immediately know that (1 << 7) is the 7th bit set. Hence, readability is
> worse, and that's important.

I don't how that BIT(7) is tricky to understand as BIT(0) implies to
be set 0th bit.
If understanding of BIT(0) is same like to be as BIT(7) and these were
simplified
macro's used most of the code in kernel.

--
Jagan.


\
 
 \ /
  Last update: 2015-05-20 22:21    [W:0.047 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site