Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:24

0001 // auto-generated file by import_utm.pl
0002 #include "CondFormats/L1TObjects/interface/L1TUtmTriggerMenu.h"
0003 
0004 //copied from tmUtil
0005 const unsigned long L1TUtmTriggerMenu::getFirmwareUuidHashed() const {
0006   const void* key = getFirmwareUuid().c_str();
0007   int len = getFirmwareUuid().size();
0008   unsigned int seed = 3735927486;
0009   return murmurHashNeutral2(key, len, seed);
0010 }
0011 
0012 //copied from tmUtil
0013 unsigned long L1TUtmTriggerMenu::murmurHashNeutral2(const void* key, int len, unsigned int seed) {
0014   // 'm' and 'r' are mixing constants generated offline.
0015   // They're not really 'magic', they just happen to work well.
0016 
0017   const unsigned int m = 0x5bd1e995;
0018   const int r = 24;
0019 
0020   // Initialize the hash to a 'random' value
0021 
0022   unsigned int h = seed ^ len;
0023 
0024   // Mix 4 bytes at a time into the hash
0025 
0026   const unsigned char* data = (const unsigned char*)key;
0027 
0028   while (len >= 4) {
0029     unsigned int k;
0030 
0031     k = data[0];
0032     k |= data[1] << 8;
0033     k |= data[2] << 16;
0034     k |= data[3] << 24;
0035 
0036     k *= m;
0037     k ^= k >> r;
0038     k *= m;
0039 
0040     h *= m;
0041     h ^= k;
0042 
0043     data += 4;
0044     len -= 4;
0045   }
0046 
0047   // Handle the last few bytes of the input array
0048 
0049   switch (len) {
0050     case 3:
0051       h ^= data[2] << 16;
0052       [[fallthrough]];
0053     case 2:
0054       h ^= data[1] << 8;
0055       [[fallthrough]];
0056     case 1:
0057       h ^= data[0];
0058       h *= m;
0059   };
0060 
0061   // Do a few final mixes of the hash to ensure the last few
0062   // bytes are well-incorporated.
0063 
0064   h ^= h >> 13;
0065   h *= m;
0066   h ^= h >> 15;
0067 
0068   return h;
0069 }