lkml.org 
[lkml]   [2009]   [Aug]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Patch 5/8] ia64: implement crashkernel=auto
Bernhard Walle wrote:
> * Ingo Molnar <mingo@elte.hu> [2009-08-24 09:43]:
>
>> * Amerigo Wang <amwang@redhat.com> wrote:
>>
>>> The reason that I kept 2ULL<<30 instead of 1ULL<<31 is that '1<<30' is
>>> exactly 1G, so 2ULL<<30 can be easily read as 2G. ;)
>>>
>> i have no trouble reading 1ULL<<31 as 2G ;-) OTOH, the logic and
>> pattern of the comparisons (especially without the comment) looked
>> odd at first sight, until i noticed this.
>>
>
> Why not just something like
>
> #define KBYTE(x) ((x)*1024ULL)
> #define MBYTE(x) ((x)*1024ULL*1024)
> #define GBYTE(x) ((x)*1024ULL*1024*1024)
> #define TBYTE(x) ((x)*1024ULL*1024*1024*1024)
>
> I find GBYTE(2) much easier to read than 1ULL<<31. Honestly, I would
> add a comment '/* 2G */' if I would write 1ULL<<31 in own code.
>
> But I'm of course not one of that super kernel hackers. ;-)
>
>

Yeah, great. Here we only need MBYTES() and GBYTES(). ;)

Thanks.




\
 
 \ /
  Last update: 2009-08-24 12:25    [W:1.355 / U:1.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site