BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
bitmanip.h
Go to the documentation of this file.
1// $Id: bitmanip.h,v 1.1.1.1 2005/10/17 06:11:40 maqm Exp $
2// bitmanip.h
3// Author: Sawyer Gillespie
4// University of Washington, Physics Department
5// March 1999
7//
8// Defines several inline routines to provide access to various
9// bit-patterns within various words. The functions byte_N return
10// the Nth byte of a given word counting from low to high bits.
11
12#ifndef _bitmanip_H__
13#define _bitmanip_H__
14
15#ifdef _MSC_VER
16#pragma once
17#endif
18
19namespace bitmanip {
20
21// template functions for getting/setting four bit words
22// i is the word #
23// v is the value
24// s it the new value
25
26template <class _T>
27inline short int word ( short i, const _T& v )
28{
29 short shft = i*4;
30 _T mask = 0x000F << shft;
31 return (v & mask) >> shft;
32}
33
34template <class _T>
35void set_word ( short i, _T& v, const _T& s )
36{
37 short shft = i*4;
38 _T mask = 0x000F << shft;
39 v = ((v & ~mask) | ((s << shft) & mask));
40}
41
42} // namespace bitmanip
43
44#endif
#define _T(str)
XmlRpcServer s
Definition: HelloServer.cpp:11
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition: KarLud.h:35
short int word(short i, const _T &v)
Definition: bitmanip.h:27
void set_word(short i, _T &v, const _T &s)
Definition: bitmanip.h:35