[Spice-devel] [PATCH 1/3] protocol: Add macros to help convert QXLPHYSICAL to/from pointers
Christophe Fergeau
cfergeau at redhat.com
Wed Jan 6 03:10:53 PST 2016
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 at codeweavers.com>
> ---
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20160106/540dcdef/attachment.sig>
More information about the Spice-devel
mailing list