ATLAS Offline Software
Loading...
Searching...
No Matches
Parity.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3*/
4/***************************************************************************
5 Parity.cpp - description
6 -------------------
7 begin : Fri Jun 28 2002
8 email : moyse@zanzibar
9 ***************************************************************************/
10
11
13
18
19unsigned int Parity::even(unsigned int word) const {
20 unsigned int numOfBits=0;
21 for (unsigned int bit=0; bit<sizeof(word); bit++){
22 if (word&(1<<bit)) numOfBits++;
23 }
24 return (numOfBits%2);
25}
26
27unsigned int Parity::odd(unsigned int word) const{
28 return (1-even(word) );
29}
~Parity()
Definition Parity.cxx:16
Parity()
Definition Parity.cxx:14
unsigned int even(unsigned int word) const
returns even parity of passed word i.e.
Definition Parity.cxx:19
unsigned int odd(unsigned int word) const
returns the odd parity of the passed word i.e.
Definition Parity.cxx:27