Re: [spice-common PATCH 1/3] ppc: Fix lz magic endianess

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

 



Hey,

On Mon, Jun 29, 2015 at 08:22:32AM -0400, Lukas Venhoda wrote:
> Hi.
> 
> I'm not sure if I follow, but I'll try to explain my reasoning as best I can.
> 
> What I meant by
> >magic will stay the same on both BE and LE machines
> was, that if we print the variable, we get the same result.

Thanks for the details, I think we are more or less meaning the same
thing. Imo "if we print the variable, we get the same result" is a bit
simplistic as the type of the value is very much important (uint8_t,
uint32_t and char[] variables will have different requirements to
achieve "printing the variable will give the same result"). If you can
write the log mentioning native endianness/LE/BE and ints, it will
probably get more accurate.

> I made this minimal example to test it on both LE and BE machine:
> 
> ---
> 
> #include <stdio.h>
> 
> #define QUIC_MAGIC_OLD (*(unsigned int *)"QUIC")
> #define QUIC_MAGIC_NEW 0x43495551
> 
> int main(void)
> {
>     printf("QUIC_MAGIC_OLD: %d\nQUIC_MAGIC_NEW: %d\n", QUIC_MAGIC_OLD, QUIC_MAGIC_NEW);
>     return 0;
> }

Just a small note, you could use %x rather than %d, this way it becomes
obvious whether 2 values would be the same after byteswapping.

Christophe

Attachment: pgpane_YTIRq5.pgp
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]