ATLAS Offline Software
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 
12 #include "TrigT1CaloUtils/Parity.h"
13 
15 }
17 }
19 unsigned 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 }
27 unsigned int Parity::odd(unsigned int word) const{
28  return (1-even(word) );
29 }
Parity::~Parity
~Parity()
Definition: Parity.cxx:16
Parity::even
unsigned int even(unsigned int word) const
returns even parity of passed word i.e.
Definition: Parity.cxx:19
Parity::odd
unsigned int odd(unsigned int word) const
returns the odd parity of the passed word i.e.
Definition: Parity.cxx:27
Parity.h
Parity::Parity
Parity()
Definition: Parity.cxx:14