[Vm-dev] The byte order fallacy

Tobias Pape Das.Linux at gmx.de
Tue Jun 13 18:35:42 UTC 2017

> On 13.06.2017, at 20:28, K K Subbu <kksubbu.ml at gmail.com> wrote:
> On Tuesday 13 June 2017 01:08 PM, Nicolas Cellier wrote:
>> last year I added SQ_SWAP_4_BYTES and SQ_SWAP_8_BYTES macros in
>> platforms/Cross/vm/sqMemoryAccess.h
>> These macros use the compiler intrinsics if possible.
>> https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/c0da5abcc7a538efd3ab6dcc4bb2d2ef3ac5c65a
>> So we should not define any new one and rather replace the suboptimal
>> ones with the ones above.
> Why not use htonl family of functions? They are part of POSIX standards and widely available in <netinet/in.h>.
> See the man pages for htonl and endian.

because "On machines which have a byte order which is the same as the network order, [htonl is] defined as null macro[]."
which defies the generality of the swapping functions. Also, per posix there's only 16 and 32 bit versions of those, but
we need 32 and 64 bit versions.

Best regards

> Regards .. Subbu

More information about the Vm-dev mailing list