public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Chris Friesen" <cfriesen@nortel.com>
To: LKML <linux-kernel@vger.kernel.org>
Subject: question on type conversions in show_map_vma()
Date: Wed, 02 Dec 2009 12:34:21 -0600	[thread overview]
Message-ID: <4B16B32D.9030106@nortel.com> (raw)


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

                 reply	other threads:[~2009-12-02 18:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B16B32D.9030106@nortel.com \
    --to=cfriesen@nortel.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox