ATLAS Offline Software
crc64.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 /*
3  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
4 */
5 /*
6  */
7 // $Id$
15 #ifndef CXXUTILS_CRC64_H
16 #define CXXUTILS_CRC64_H
17 
18 
19 #include "CxxUtils/features.h"
20 #include <memory>
21 #include <cstdint>
22 #include <string>
23 
24 
25 // Use the vectorized version if we're compiling with gcc on x86_64.
26 // clang > 7 allows function multiversioning but some of the intrinsics we
27 // use exist only for gcc
28 #if defined(__x86_64__) && HAVE_GCC_INTRINSICS
29 # define ATH_CRC64_VEC 1
30 #else
31 # define ATH_CRC64_VEC 0
32 #endif
33 
34 
35 // Forward declarations.
36 namespace CxxUtils {
38 class CRCTable;
41 }
42 
43 
47 namespace std {
48 template<>
49 struct default_delete<CxxUtils::CRCTable>
50 {
51  void operator() (CxxUtils::CRCTable* table) const
52  { deleteCRCTable (table); }
53 };
54 }
55 
56 
57 namespace CxxUtils {
58 
59 
60 class CRCTable;
61 
62 
69 std::unique_ptr<CRCTable> makeCRCTable (uint64_t p,
70  uint64_t initial = 0xffffffffffffffff);
71 
72 
79 uint64_t crc64_bytewise (const CRCTable& table,
80  const char* data,
81  size_t data_len);
82 
83 
91 uint64_t crc64_bytewise (const char* data,
92  size_t data_len);
93 
94 
101 uint64_t crc64_bytewise (const std::string& s);
102 
103 
104 #if ATH_CRC64_VEC
105 
113 __attribute__ ((target ("pclmul")))
114 uint64_t crc64 (const CRCTable& table,
115  const char* data,
116  size_t data_len);
117 #endif // ATH_CRC64_VEC
118 
119 
128 #if ATH_CRC64_VEC
129 __attribute__ ((target ("default")))
130 #endif
131 uint64_t crc64 (const CRCTable& table,
132  const char* data,
133  size_t data_len);
134 
135 
141 uint64_t crc64 (const char* data,
142  size_t data_len);
143 
144 
149 uint64_t crc64 (const std::string& s);
150 
151 
159 
160 
165 std::string crc64format (uint64_t crc);
166 
167 
168 
169 
176 std::string crc64digest (const std::string& str);
177 
178 
179 } // namespace CxxUtils
180 
181 
182 #endif // not CXXUTILS_CRC64_H
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
features.h
Some additional feature test macros.
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
CxxUtils::crc64_bytewise
uint64_t crc64_bytewise(const CRCTable &table, const char *data, size_t data_len)
Find the CRC-64 of a string, using a byte-by-byte algorithm.
Definition: crc64.cxx:560
CxxUtils::deleteCRCTable
void deleteCRCTable(CxxUtils::CRCTable *table)
Delete a CRCTable object.
Definition: crc64.cxx:535
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
x
#define x
CxxUtils::CRCTable
Precomputed tables and constants for the CRC calculation.
Definition: crc64.cxx:465
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
CxxUtils
Definition: aligned_vector.h:29
CxxUtils::crc64addint
uint64_t crc64addint(uint64_t crc, uint64_t x)
Extend a previously-calculated CRC to include an int.
Definition: crc64.cxx:732
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
CxxUtils::crc64
uint64_t crc64(const CRCTable &table, const char *data, size_t data_len)
Find the CRC-64 of a string,.
Definition: crc64.cxx:696
python.ext.table_printer.table
list table
Definition: table_printer.py:81
CxxUtils::makeCRCTable
std::unique_ptr< CRCTable > makeCRCTable(uint64_t p, uint64_t initial=0xffffffffffffffff)
Initialize CRC tables and constants.
Definition: crc64.cxx:547
__attribute__
__attribute__((always_inline)) inline uint16_t TileCalibDrawerBase
Definition: TileCalibDrawerBase.h:190
CxxUtils::crc64format
std::string crc64format(uint64_t crc)
Format a CRC-64 as a string.
Definition: crc64.cxx:746
copySelective.target
string target
Definition: copySelective.py:37
str
Definition: BTagTrackIpAccessor.cxx:11
CxxUtils::crc64digest
std::string crc64digest(const std::string &str)
Return a CRC-64 digest of a string.
Definition: crc64.cxx:761