]> git.mxchange.org Git - flightgear.git/commitdiff
Add a byte swap test utility.
authorehofman <ehofman>
Tue, 20 Sep 2005 09:35:20 +0000 (09:35 +0000)
committerehofman <ehofman>
Tue, 20 Sep 2005 09:35:20 +0000 (09:35 +0000)
src/MultiPlayer/Makefile.am
src/MultiPlayer/swap_test.cpp [new file with mode: 0644]

index 9057a991c4d3239f95e530d9681bc5cc03e5454f..0ad23d80a7942550d09d2b3d28d62ad95ffc05f3 100644 (file)
@@ -1,3 +1,7 @@
+noinst_PROGRAMS = swap_test
+
+swap_test_SOURCES = swap_test.cpp
+
 noinst_LIBRARIES = libMultiPlayer.a
 
 libMultiPlayer_a_SOURCES = multiplayrxmgr.cxx multiplayrxmgr.hxx multiplaytxmgr.cxx multiplaytxmgr.hxx mpplayer.cxx mpplayer.hxx mpmessages.hxx tiny_xdr.cpp tiny_xdr.hpp
diff --git a/src/MultiPlayer/swap_test.cpp b/src/MultiPlayer/swap_test.cpp
new file mode 100644 (file)
index 0000000..5f91521
--- /dev/null
@@ -0,0 +1,15 @@
+
+#include <stdio.h>
+#include <stdint.h>
+#include "tiny_xdr.hpp"
+
+int main() 
+{
+   uint32_t ui32 = 0xFFAACCEE;
+   uint64_t ui64 = 0x00BBAADDFFAACCEELL;
+
+   printf("UI32: (normal) %x\nUI32: (swapped) %x\n\n", ui32, bswap_32(ui32) );
+   printf("UI64: (normal) %llx\nUI64: (swapped) %llx\n\n", ui64, bswap_64(ui64) );
+
+   return 0;
+}