Fix undefined behaviour.
authorbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 21 Feb 2011 22:27:21 +0000 (22:27 +0000)
committerbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 21 Feb 2011 22:27:21 +0000 (22:27 +0000)
commit0a06817da12212b29cac740066fe51c89e1084af
tree3d2afef1815bf027004757145230baa7c043dfb6
parent620a5af8d34e5e7e9fc902eb46537faa479411f4
Fix undefined behaviour.

In the expression:
(a) ^= (b) ^= (a) ^= (b)
'a' and 'b' are evaluated and assigned multiple times, and it is
not clear in which order operations are performed.
This patch re-write the XOR swap in a more canonical way.

git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4719 38d2e660-2303-0410-9eaa-f027e97ec537
bertos/cpu/byteorder.h
bertos/cpu/byteorder_test.c [new file with mode: 0644]