Add a byte swap test utility.
This commit is contained in:
parent
7311d05c87
commit
ab7489e20d
2 changed files with 19 additions and 0 deletions
|
@ -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
|
||||
|
|
15
src/MultiPlayer/swap_test.cpp
Normal file
15
src/MultiPlayer/swap_test.cpp
Normal file
|
@ -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;
|
||||
}
|
Loading…
Reference in a new issue