Skip to content

Commit

Permalink
[GCC9] fix left shift of negative value warning for SimRomanPot/SimFP420
Browse files Browse the repository at this point in the history
  • Loading branch information
smuzaffar committed Oct 25, 2019
1 parent 3717faa commit 726b7c7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions SimRomanPot/SimFP420/src/DigiConverterFP420.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ DigiConverterFP420::DigiConverterFP420(float in, int verbosity) {
electronperADC = in;
verbos = verbosity;

const int defaultBits = 10;
const int largestBits = 30;
constexpr int defaultBits = 10;
constexpr int largestBits = 30;
constexpr unsigned int allOne = ~0;

// example is in SiStrips:
// static SimpleConfigurable<int>
Expand All @@ -21,7 +22,7 @@ DigiConverterFP420::DigiConverterFP420(float in, int verbosity) {
if (adcBits > largestBits || adcBits < 1)
adcBits = largestBits;

theMaxADC = ~(~0 << adcBits);
theMaxADC = ~(allOne << adcBits);
// std::cout << "theMaxADC= "<< theMaxADC << std::endl; // = 1023
if (verbos > 0) {
std::cout << " ***DigiConverterFP420: constructor" << std::endl;
Expand Down

0 comments on commit 726b7c7

Please sign in to comment.