Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:13:14

0001 #include "FWCore/Utilities/interface/Likely.h"
0002 #include <iostream>
0003 #include <cassert>
0004 
0005 // test that compiles and does not interfere with the logic...
0006 namespace {
0007   bool test(int n) {
0008     bool ret=true;
0009     if (LIKELY(n>1)) ret&=true; 
0010     else
0011       ret=false;
0012     
0013     if (UNLIKELY(n>1)) ret&=true;
0014     else
0015       ret =false;
0016 
0017     ret &=LIKELY(n>1);
0018     ret &=UNLIKELY(n>1);
0019     return ret;
0020   }
0021 }
0022 
0023 
0024 int main() {
0025 #ifdef NO_LIKELY
0026   std::cout << "NO_LIKELY" << std::endl;
0027 #endif
0028 #ifdef REVERSE_LIKELY
0029   std::cout << "REVERSE_LIKELY" << std::endl;
0030 #endif
0031 
0032   assert(!test(0));
0033   assert(test(2));
0034 
0035   return 0;
0036 }