* CatalogCacheComputeHashValue * * Compute the hash value associated with a given set of lookup keys */
| 268 | * Compute the hash value associated with a given set of lookup keys |
| 269 | */ |
| 270 | static uint32 |
| 271 | CatalogCacheComputeHashValue(CatCache *cache, int nkeys, |
| 272 | Datum v1, Datum v2, Datum v3, Datum v4) |
| 273 | { |
| 274 | uint32 hashValue = 0; |
| 275 | uint32 oneHash; |
| 276 | CCHashFN *cc_hashfunc = cache->cc_hashfunc; |
| 277 | |
| 278 | CACHE_elog(DEBUG2, "CatalogCacheComputeHashValue %s %d %p", |
| 279 | cache->cc_relname, nkeys, cache); |
| 280 | |
| 281 | switch (nkeys) |
| 282 | { |
| 283 | case 4: |
| 284 | oneHash = (cc_hashfunc[3]) (v4); |
| 285 | |
| 286 | hashValue ^= oneHash << 24; |
| 287 | hashValue ^= oneHash >> 8; |
| 288 | /* FALLTHROUGH */ |
| 289 | case 3: |
| 290 | oneHash = (cc_hashfunc[2]) (v3); |
| 291 | |
| 292 | hashValue ^= oneHash << 16; |
| 293 | hashValue ^= oneHash >> 16; |
| 294 | /* FALLTHROUGH */ |
| 295 | case 2: |
| 296 | oneHash = (cc_hashfunc[1]) (v2); |
| 297 | |
| 298 | hashValue ^= oneHash << 8; |
| 299 | hashValue ^= oneHash >> 24; |
| 300 | /* FALLTHROUGH */ |
| 301 | case 1: |
| 302 | oneHash = (cc_hashfunc[0]) (v1); |
| 303 | |
| 304 | hashValue ^= oneHash; |
| 305 | break; |
| 306 | default: |
| 307 | elog(FATAL, "wrong number of hash keys: %d", nkeys); |
| 308 | break; |
| 309 | } |
| 310 | |
| 311 | return hashValue; |
| 312 | } |
| 313 | |
| 314 | /* |
| 315 | * CatalogCacheComputeTupleHashValue |
no outgoing calls
no test coverage detected