StRoot
1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
StTriggerUtilities
StDSMUtilities
bits.hh
1
//
2
// Pibero Djawotho <pibero@tamu.edu>
3
// Texas A&M University
4
// 14 Jan 2011
5
//
6
7
#ifndef BITS_HH
8
#define BITS_HH
9
#include<stdio.h>
10
// returns value of bit from x at position pos
11
inline
int
btest(
int
x,
int
pos) {
return
x >> pos & 1; }
12
13
// returns n bits from x starting at position pos
14
inline
int
getbits(
int
x,
int
pos,
int
n) {
return
x >> pos & ~(~0 << n); }
15
16
// OR x with value starting at position pos
17
inline
void
setbits(
int
& x,
int
pos,
int
value) { x |= value << pos; }
18
19
#endif // BITS_HH
Generated by
1.8.5