Re: [PATCH 1/3] protocol: Add macros to help convert QXLPHYSICAL to/from pointers

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

 



On Mon, Dec 28, 2015 at 11:06:37AM +0100, Francois Gouget wrote:
> On 32 bit systems the QXLPHYSICAL integer size deos not match the size
> of a pointer so special care must be taken in the conversions to avoid
> compiler errors with -Werror.
> 
> Signed-off-by: Francois Gouget <fgouget@xxxxxxxxxxxxxxx>
> ---
>  spice/qxl_dev.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/spice/qxl_dev.h b/spice/qxl_dev.h
> index 9e753c4..01cfe81 100644
> --- a/spice/qxl_dev.h
> +++ b/spice/qxl_dev.h
> @@ -101,8 +101,10 @@ enum {
>      QXL_IO_RANGE_SIZE
>  };
>  
> -typedef uint64_t QXLPHYSICAL;
>  typedef int32_t QXLFIXED; //fixed 28.4
> +typedef uint64_t QXLPHYSICAL;
> +#define PTR_TO_QXLPHYSICAL(ptr) ((QXLPHYSICAL)(intptr_t)ptr)

I'd call this QXLPHYSICAL_FROM_PTR to keep it namespaced.

> +#define QXLPHYSICAL_TO_PTR(ptrtype, phy) ((ptrtype)(intptr_t)phy)

Do you need (ptrtype) here ? If you cast to (void *), I think this can
be implicitly cast to any other pointer type.

Christophe

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]