Skip to content

Commit 5730fcb

Browse files
remove hash pair
1 parent 53ce6b5 commit 5730fcb

1 file changed

Lines changed: 1 addition & 16 deletions

File tree

libudpard/udpard.c

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,6 @@ static int64_t max_i64(const int64_t a, const int64_t b) { return (a > b) ?
8888
static udpard_us_t earlier(const udpard_us_t a, const udpard_us_t b) { return min_i64(a, b); }
8989
static udpard_us_t later(const udpard_us_t a, const udpard_us_t b) { return max_i64(a, b); }
9090

91-
/// A simple hash for two u64 arguments based on the SplitMix64 finalizer.
92-
/// Much better than a simple xor while not being too heavy.
93-
/// The hashing is only used on internal representations and does not affect wire compatibility.
94-
static uint64_t hash_pair_u64(const uint64_t a, const uint64_t b)
95-
{
96-
uint64_t x = a ^ (b + 0x9E3779B97F4A7C15ULL);
97-
x ^= (a >> 32U) ^ (b << 32U);
98-
x ^= x >> 30U;
99-
x *= 0xBF58476D1CE4E5B9ULL;
100-
x ^= x >> 27U;
101-
x *= 0x94D049BB133111EBULL;
102-
x ^= x >> 31U;
103-
return x;
104-
}
105-
10691
/// Two memory resources are considered identical if they share the same user pointer and the same allocation function.
10792
/// The deallocation function is intentionally excluded from the comparison.
10893
static bool mem_same(const udpard_mem_t a, const udpard_mem_t b)
@@ -1201,7 +1186,7 @@ bool udpard_tx_new(udpard_tx_t* const self,
12011186
mem_zero(sizeof(*self), self);
12021187
self->vtable = vtable;
12031188
self->local_uid = local_uid;
1204-
self->p2p_transfer_id = hash_pair_u64(p2p_transfer_id_seed, local_uid);
1189+
self->p2p_transfer_id = p2p_transfer_id_seed ^ local_uid; // extra entropy
12051190
self->ack_baseline_timeout = UDPARD_TX_ACK_BASELINE_TIMEOUT_DEFAULT_us;
12061191
self->enqueued_frames_limit = enqueued_frames_limit;
12071192
self->enqueued_frames_count = 0;

0 commit comments

Comments
 (0)