Revision: 3668 Author: nice Date: 2016-04-05 11:11:36 -0700 (Tue, 05 Apr 2016) Log Message: ----------- Provide macros for conditionnally byte-swapping depending on VM endianness
Modified Paths: -------------- branches/Cog/platforms/Cross/vm/sqMemoryAccess.h
Modified: branches/Cog/platforms/Cross/vm/sqMemoryAccess.h =================================================================== --- branches/Cog/platforms/Cross/vm/sqMemoryAccess.h 2016-04-02 21:58:22 UTC (rev 3667) +++ branches/Cog/platforms/Cross/vm/sqMemoryAccess.h 2016-04-05 18:11:36 UTC (rev 3668) @@ -233,7 +233,16 @@ ( (unsigned long long)(x) >> 56)) #endif
+/* Since Large Integers are Bytes Oops allways stored as little endian, + the following macros are handy to retrieve 4 or 8 byte limbs */ +#if VMBIGENDIAN +# define SQ_SWAP_4_BYTES_IF_BIGENDIAN(x) SQ_SWAP_4_BYTES(x) +# define SQ_SWAP_8_BYTES_IF_BIGENDIAN(x) SQ_SWAP_8_BYTES(x) +#else +# define SQ_SWAP_4_BYTES_IF_BIGENDIAN(x) (x) +# define SQ_SWAP_8_BYTES_IF_BIGENDIAN(x) (x)
+ /* This doesn't belong here, but neither do 'self flag: ...'s belong in the image. We use a macro, not an inline function; we need no trace of flag. */
Oops, sorry for the missing endif, I messed up with file merging.
2016-04-05 20:11 GMT+02:00 commits@squeakvm.org:
Revision: 3668 Author: nice Date: 2016-04-05 11:11:36 -0700 (Tue, 05 Apr 2016) Log Message:
Provide macros for conditionnally byte-swapping depending on VM endianness
Modified Paths:
branches/Cog/platforms/Cross/vm/sqMemoryAccess.h
Modified: branches/Cog/platforms/Cross/vm/sqMemoryAccess.h
--- branches/Cog/platforms/Cross/vm/sqMemoryAccess.h 2016-04-02 21:58:22 UTC (rev 3667) +++ branches/Cog/platforms/Cross/vm/sqMemoryAccess.h 2016-04-05 18:11:36 UTC (rev 3668) @@ -233,7 +233,16 @@ ( (unsigned long long)(x) >> 56)) #endif
+/* Since Large Integers are Bytes Oops allways stored as little endian,
- the following macros are handy to retrieve 4 or 8 byte limbs */
+#if VMBIGENDIAN +# define SQ_SWAP_4_BYTES_IF_BIGENDIAN(x) SQ_SWAP_4_BYTES(x) +# define SQ_SWAP_8_BYTES_IF_BIGENDIAN(x) SQ_SWAP_8_BYTES(x) +#else +# define SQ_SWAP_4_BYTES_IF_BIGENDIAN(x) (x) +# define SQ_SWAP_8_BYTES_IF_BIGENDIAN(x) (x)
/* This doesn't belong here, but neither do 'self flag: ...'s belong in the image. We use a macro, not an inline function; we need no trace of flag. */
vm-dev@lists.squeakfoundation.org