|
SNAP Library 2.0, User Reference
2013-05-13 16:33:57
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
Computes a hash code from a pair of hash codes. More...
#include <bd.h>
Static Public Member Functions | |
| static int | GetHashCd (const int hc1, const int hc2) |
Computes a hash code from a pair of hash codes.
Both TPairHashImpl1 and TPairHashImpl2 implement the same function: ((a + b) * (a + b + 1) / 2) + a.
| static int TPairHashImpl2::GetHashCd | ( | const int | hc1, |
| const int | hc2 | ||
| ) | [inline, static] |
Definition at line 590 of file bd.h.
{
unsigned long long sum = ((unsigned long long) hc1) + ((unsigned long long) hc2);
unsigned long long c = ((sum * (sum + 1)) >> 1) + hc1;
unsigned int R = (unsigned int) (c >> 31), Q = (unsigned int) (c & 0x7fffffffULL);
if ((R & 0x80000000U) != 0) R -= 0x7fffffffU;
unsigned int RQ = R + Q;
if (RQ < 0x7fffffffU) return (int) RQ;
RQ -= 0x7fffffffU;
return (RQ == 0x7fffffffU) ? 0 : (int) RQ; }