From c912e5b877bc772b62f84a81a49a5f6ff8227ae3 Mon Sep 17 00:00:00 2001 From: John Romein <romein@astron.nl> Date: Mon, 29 Jan 2007 13:18:06 +0000 Subject: [PATCH] BugID: 225 Fix byte order bug for big-endian machines. --- Appl/CEP/CS1/CS1_InputSection/src/InputThread.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Appl/CEP/CS1/CS1_InputSection/src/InputThread.cc b/Appl/CEP/CS1/CS1_InputSection/src/InputThread.cc index 1c897ea8ace..9b1a6477df5 100644 --- a/Appl/CEP/CS1/CS1_InputSection/src/InputThread.cc +++ b/Appl/CEP/CS1/CS1_InputSection/src/InputThread.cc @@ -27,6 +27,7 @@ #include <Common/LofarLogger.h> #include <Common/hexdump.h> #include <CS1_InputSection/InputThread.h> +#include <Common/DataConvert.h> #include <Common/Timer.h> #include <Transport/TransportHolder.h> #include <Transport/TH_MPI.h> @@ -112,6 +113,11 @@ retry: // until valid packet received unsigned seqid = * ((unsigned *) &recvframe[8]); unsigned blockid = * ((unsigned *) &recvframe[12]); +#if defined WORDS_BIGENDIAN + seqid = byteSwap(seqid); + blockid = byteSwap(blockid); +#endif + //if the seconds counter is 0xFFFFFFFF, the data cannot be trusted. if (seqid == ~0U) { ++ nrPacketsRejected; -- GitLab