Project
Loading...
Searching...
No Matches
BigEndian.h
Go to the documentation of this file.
1// Copyright 2019-2026 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#ifndef O2_FRAMEWORK_BIGENDIAN_H_
13#define O2_FRAMEWORK_BIGENDIAN_H_
14
15#include <bit>
16#include <cstddef>
17#include <cstdint>
18#include <cstring>
19
20namespace o2::framework
21{
22
26inline void bigEndianCopy(void* dest, const void* src, int count, size_t typeSize)
27{
28 auto const totalBytes = static_cast<size_t>(count) * typeSize;
29 if constexpr (std::endian::native == std::endian::big) {
30 std::memcpy(dest, src, totalBytes);
31 return;
32 }
33 switch (typeSize) {
34 case 2: {
35 auto* p = static_cast<uint16_t*>(dest);
36 auto* q = static_cast<const uint16_t*>(src);
37 for (int i = 0; i < count; ++i) {
38 p[i] = __builtin_bswap16(q[i]);
39 }
40 return;
41 }
42 case 4: {
43 auto* p = static_cast<uint32_t*>(dest);
44 auto* q = static_cast<const uint32_t*>(src);
45 for (int i = 0; i < count; ++i) {
46 p[i] = __builtin_bswap32(q[i]);
47 }
48 return;
49 }
50 case 8: {
51 auto* p = static_cast<uint64_t*>(dest);
52 auto* q = static_cast<const uint64_t*>(src);
53 for (int i = 0; i < count; ++i) {
54 p[i] = __builtin_bswap64(q[i]);
55 }
56 return;
57 }
58 }
59 std::memcpy(dest, src, totalBytes);
60}
61
62} // namespace o2::framework
63
64#endif // O2_FRAMEWORK_BIGENDIAN_H_
unsigned short int uint16_t
int32_t i
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
GLenum src
Definition glcorearb.h:1767
GLint GLsizei count
Definition glcorearb.h:399
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
void bigEndianCopy(void *dest, const void *src, int count, size_t typeSize)
Definition BigEndian.h:26