-----Original Message----- From: Dan Carpenter [mailto:dan.carpenter@oracle.com] Sent: Tuesday, August 25, 2015 1:51 PM To: Zhou, David(ChunMing) Cc: dri-devel@lists.freedesktop.org Subject: Re: drm/amdgpu: implement cgs gpu memory callbacks
On Tue, Aug 25, 2015 at 02:07:21AM +0000, Zhou, David(ChunMing) wrote:
and can the shift actually wrap?
[DZ] of course, adding shift wrap is better. fpfn/lpfn is page number, so
<<PAGE_SHIFT is to convert to memory size.
By "Shift wrap" I meant how you shift beyond the end of a 32bit number and it truncates, or if it's signed then it can wrap around (it's undefined actually, I probably should use a different word?).
int main(void) { unsigned long long a = 0xf0000000U << 12; unsigned long long b = 0xf0000000ULL << 12;
printf("%llx %llx\n", a, b);
return 0; }
[DZ] oh, I understand your mean, with previous PAGE_SHIFT, I think it should be like 'b' in your example without truncates.
Thanks, David Zhou
regards, dan carpenter