Project
Loading...
Searching...
No Matches
bitOps.h
Go to the documentation of this file.
1
// Copyright 2019-2020 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 MATHUTILS_INCLUDE_MATHUTILS_DETAIL_BITOPS_H_
17
#define MATHUTILS_INCLUDE_MATHUTILS_DETAIL_BITOPS_H_
18
19
#ifndef GPUCA_GPUCODE_DEVICE
20
#include <cstdint>
21
#endif
22
23
namespace
o2
24
{
25
namespace
math_utils
26
{
27
namespace
detail
28
{
29
// fast bit count
30
inline
int
numberOfBitsSet
(uint32_t
x
)
31
{
32
// count number of non-0 bits in 32bit word
33
x
=
x
- ((
x
>> 1) & 0x55555555);
34
x
= (
x
& 0x33333333) + ((
x
>> 2) & 0x33333333);
35
return
(((
x
+ (
x
>> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
36
}
37
38
// recursive creation of bitmask
39
template
<
typename
T>
40
constexpr
uint32_t
bit2Mask
(
T
v
)
41
{
42
return
0x1 <<
v
;
43
}
44
45
template
<
typename
T
,
typename
... Args>
46
constexpr
uint32_t
bit2Mask
(
T
first
, Args... args)
47
{
48
return
(0x1 <<
first
) |
bit2Mask
(args...);
49
}
50
51
}
// namespace detail
52
}
// namespace math_utils
53
}
// namespace o2
54
55
#endif
/* MATHUTILS_INCLUDE_MATHUTILS_DETAIL_BITOPS_H_ */
int
x
GLint GLenum GLint x
Definition
glcorearb.h:403
v
const GLdouble * v
Definition
glcorearb.h:832
o2::math_utils::detail::numberOfBitsSet
int numberOfBitsSet(uint32_t x)
Definition
bitOps.h:30
o2::math_utils::detail::bit2Mask
constexpr uint32_t bit2Mask(T v)
Definition
bitOps.h:40
o2::math_utils::detail::T
T
Definition
SMatrixGPU.h:747
o2
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Definition
BitstreamReader.h:24
Common
MathUtils
include
MathUtils
detail
bitOps.h
Generated on Tue Feb 25 2025 23:16:08 for Project by
1.9.8