Not all the fields, just the 32 bits fields - while the 16 bits fields have to be rotated by 8 and the bytes have to be left untouched.
What is costly is not the byteswapping, it is all the code to process fields length (each field length and position is only known in the protocol layer where the field is defined, you cannot do a big function messages_swap() at all).
I would like to have the attribute((big-endian)) in gcc, but I guess the market share of big endian processor no more worth the improvement...
Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds