[Spice-devel] [spice-common PATCH 2/3 v2] ppc: Fix quic magic endianess

Lukas Venhoda lvenhoda at redhat.com
Mon Jun 29 05:58:26 PDT 2015


Runtime conversion from a string to uint32 is storing the magic with the same
endianness on both LE and BE machines. This requires aditional byte swap
when sending magic between LE/BE machines.

Changing quic magic to a constant will ensure, that it will be always stored in
native endianness, and the second byte swap won't be needed.
---
Changes since v1:
 - Improved commit log
---
 common/quic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/quic.c b/common/quic.c
index 16290d4..498b9cc 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -35,7 +35,8 @@
 //#define RLE_PRED_3
 #define QUIC_RGB

-#define QUIC_MAGIC (*(uint32_t *)"QUIC")
+/* ASCII "QUIC" */
+#define QUIC_MAGIC 0x43495551
 #define QUIC_VERSION_MAJOR 0U
 #define QUIC_VERSION_MINOR 1U
 #define QUIC_VERSION ((QUIC_VERSION_MAJOR << 16) | (QUIC_VERSION_MAJOR & 0xffff))
--
2.4.3



More information about the Spice-devel mailing list