Project
Loading...
Searching...
No Matches
codertraits.h
Go to the documentation of this file.
1// Copyright 2019-2023 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
15
16#ifndef RANS_INTERNAL_COMMON_CODERTRAITS_H_
17#define RANS_INTERNAL_COMMON_CODERTRAITS_H_
18
19#include <cstddef>
20#include <cstdint>
21#include <cstring>
22
26
27#include <cstdint>
28
29namespace o2::rans
30{
31
32namespace defaults
33{
34
35template <CoderTag tag_V = DefaultTag>
37
38template <>
40 inline static constexpr size_t nStreams = 2;
41 inline static constexpr size_t renormingLowerBound = internal::RenormingLowerBound;
42};
43
44#ifdef RANS_SINGLE_STREAM
45template <>
47 inline static constexpr size_t nStreams = 2;
48 inline static constexpr size_t renormingLowerBound = internal::RenormingLowerBound;
49};
50#endif
51
52#ifdef RANS_SSE
53template <>
54struct CoderPreset<CoderTag::SSE> {
55 inline static constexpr size_t nStreams = 16;
56 inline static constexpr size_t renormingLowerBound = internal::RenormingLowerBound;
57};
58#endif
59
60#ifdef RANS_AVX2
61template <>
62struct CoderPreset<CoderTag::AVX2> {
63 inline static constexpr size_t nStreams = 16;
64 inline static constexpr size_t renormingLowerBound = internal::RenormingLowerBound;
65};
66#endif
67
68} // namespace defaults
69
70namespace internal
71{
72template <CoderTag tag_V>
74};
75
76template <>
78
79 template <size_t lowerBound_V = defaults::CoderPreset<CoderTag::Compat>::renormingLowerBound>
81};
82
83#ifdef RANS_SINGLE_STREAM
84template <>
86
87 template <size_t lowerBound_V = defaults::CoderPreset<CoderTag::SingleStream>::renormingLowerBound>
88 using type = SingleStreamEncoderImpl<lowerBound_V>;
89};
90#endif /* RANS_SINGLE_STREAM */
91
92#ifdef RANS_SSE
93template <>
94struct CoderTraits<CoderTag::SSE> {
95
96 template <size_t lowerBound_V = defaults::CoderPreset<CoderTag::SSE>::renormingLowerBound>
97 using type = SSEEncoderImpl<lowerBound_V>;
98};
99#endif /* RANS_SSE */
100
101#ifdef RANS_AVX2
102template <>
103struct CoderTraits<CoderTag::AVX2> {
104
105 template <size_t lowerBound_V = defaults::CoderPreset<CoderTag::AVX2>::renormingLowerBound>
106 using type = AVXEncoderImpl<lowerBound_V>;
107};
108#endif /* RANS_AVX2 */
109
110template <CoderTag tag_V = defaults::DefaultTag, size_t lowerBound_V = defaults::CoderPreset<tag_V>::renormingLowerBound>
112} // namespace internal
113
114} // namespace o2::rans
115
116#endif /* RANS_INTERNAL_COMMON_CODERTRAITS_H_ */
preprocessor defines to enable features based on CPU architecture
GLint GLint GLsizei GLint GLenum GLenum type
Definition glcorearb.h:275
constexpr size_t RenormingLowerBound
Definition defaults.h:53
typename CoderTraits< tag_V >::template type< lowerBound_V > CoderTraits_t
manipulation of types at compile time