public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* question on type conversions in show_map_vma()
@ 2009-12-02 18:34 Chris Friesen
  0 siblings, 0 replies; only message in thread
From: Chris Friesen @ 2009-12-02 18:34 UTC (permalink / raw)
  To: LKML


Another developer and I were looking at show_map_vma() and started
wondering about the "pgoff" value:

pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;

Here we take a variable of type "unsigned long", we cast it to "long
long", shift it, then assign the result to a variable of type "unsigned
long long".

I realize that there isn't any danger of invalid sign extension, but it
does seem a bit odd to be casting to a signed value when the result is
going to be unsigned.

Is there a historical reason why pgoff is unsigned rather than just of
type "loff_t"?

Chris

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-12-02 18:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-02 18:34 question on type conversions in show_map_vma() Chris Friesen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox