lkml.org 
[lkml]   [2009]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 61/7] x86/pci: add cap_4g
On 12/11/2009 06:20 PM, Yinghai Lu wrote:
>>
>> How about:
>>
>> static inline resource_size_t cap_resource(u64 val)
>> {
>> if (val > ~(resource_size_t)0)
>> return ~(resource_size_t)0;
>> else
>> return val;
>> }
>
> ok

Stylisically I guess the idiom:

(resource_size_t)~0

... is better, not that it matters in this case, but the (type)~0 idiom
gets the correct answer even when sizeof(type) < sizeof(int).

-hpa

--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.



\
 
 \ /
  Last update: 2009-12-12 03:29    [W:0.024 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site