All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yoann Padioleau <padator@wanadoo.fr>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] question on double cast
Date: Tue, 22 May 2007 12:15:13 +0000	[thread overview]
Message-ID: <873b1p2gxa.fsf@wanadoo.fr> (raw)
In-Reply-To: <87y7jh4669.fsf@wanadoo.fr>

"John Anthony Kazos Jr." <jakj@j-a-k-j.com> writes:

>> In drivers/infiniband/hw/amso1100/c2_cm.c", line 321
>> there is
>> 
>>  	wr->ep_handle = (u32) (unsigned long) cm_id->provider_data;
>> 
>> What is the goal of this double cast ? There are plenty of
>> such double cast in the kernel.
>
> provider_data is type "void *", so presumably the object it points to is 
> of type [un]signed long (meaning its size differs on different 
> architectures). It is being cast to unsigned long to set it to that size 
> with no sign bits, and then the low-order 32 bits are being chopped off.

But isn't it equivalent to directly do 

  wr->ep_handle = (u32) cm_id->provider_data;

? 




> _______________________________________________
> Kernel-janitors mailing list
> Kernel-janitors@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

  parent reply	other threads:[~2007-05-22 12:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-22  8:24 [KJ] question on double cast Yoann Padioleau
2007-05-22 11:44 ` John Anthony Kazos Jr.
2007-05-22 12:15 ` Yoann Padioleau [this message]
2007-05-22 12:52 ` John Anthony Kazos Jr.
2007-05-22 12:54 ` Matthew Wilcox
2007-05-22 13:44 ` Matthew Wilcox

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=873b1p2gxa.fsf@wanadoo.fr \
    --to=padator@wanadoo.fr \
    --cc=kernel-janitors@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.