[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 08 of 15] hvmloader: Add a simple "scratch allocator"

  • To: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, Ian Campbell <ian.campbell@xxxxxxxxxx>
  • From: Keir Fraser <keir.xen@xxxxxxxxx>
  • Date: Thu, 02 Jun 2011 21:00:47 +0100
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 02 Jun 2011 13:03:51 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=user-agent:date:subject:from:to:cc:message-id:thread-topic :thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; b=RZ5wZywJxsnxRQAJd92taTNAOJJH2kgbmMK+7Ruj9fYbrOnA/0fI2kuvmdT1zu3qq1 y79bqJDrFUsy5GVre/7umqhQM3iRaKUeCHH3MYQNAYigBfT8j2kWqP3zuT26bbck+m34 og6vvGyDEGflALro1MKer61vpRZ+8CGY03i6Y=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: AcwhX8NaqqKWzUFMr06r2NZT/R6/Yg==
  • Thread-topic: [Xen-devel] [PATCH 08 of 15] hvmloader: Add a simple "scratch allocator"

On 02/06/2011 20:43, "Konrad Rzeszutek Wilk" <konrad.wilk@xxxxxxxxxx> wrote:

>> +    return (void *)(unsigned long)s;
> Why the double cast?

gcc complains if you cast between a pointer and an integer of a different
size. We assume in many places that a pointer is same size as a long, so we
cast through a long when the original integer type may be different size. In
this case, in hvmloader, we know that pointers/longs/uint32_t are all
32-bit, but still I quite like the principle of always casting through a
long when the integer is not explicitly that type already.

 -- Keir

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.