Belle II Software  release-05-01-25
ROIrawID.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2013 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Giulia Casarosa, Eugenio Paoloni *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <arpa/inet.h>
12 #include <tracking/dataobjects/ROIrawID.h>
13 using namespace Belle2;
14 
16 {
17  // return ROIrawID::baseType htobe64(m_rawID.id);
18 
19  uint32_t low_host, hi_host;
20  uint64_t low_be, hi_be;
21 
22  /* Return immediately if byte order is big endian. */
23  if (htonl(0x01020304) == 0x01020304)
24  return m_rawID.id;
25  /* Change byte order in low and high words. */
26  low_host = m_rawID.id & 0x00000000FFFFFFFF;
27  hi_host = (m_rawID.id & 0xFFFFFFFF00000000) >> 32;
28  low_be = htonl(low_host);
29  hi_be = htonl(hi_host);
30  /* Exchange low and high words. */
31  return (ROIrawID::baseType)(low_be << 32 | hi_be);
32 }
Belle2::ROIrawID::baseType
uint64_t baseType
base type
Definition: ROIrawID.h:38
Belle2::ROIrawID::getBigEndian
baseType getBigEndian() const
get bigEndian
Definition: ROIrawID.cc:15
Belle2::ROIrawID::m_rawID
union Belle2::ROIrawID::@271 m_rawID
raw ID
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19