MCPcopy Create free account
hub / github.com/defold/defold / BitDifference

Function BitDifference

engine/dlib/src/dlib/socket.cpp:56–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54 }
55
56 uint32_t BitDifference(Address a, Address b)
57 {
58 // Implements the Hamming Distance algorithm.
59 // https://en.wikipedia.org/wiki/Hamming_distance
60 uint32_t difference = 0;
61 for (uint32_t i = 0; i < (sizeof(a.m_address) / sizeof(uint32_t)); ++i)
62 {
63 uint32_t current = a.m_address[i] ^ b.m_address[i];
64 while (current != 0)
65 {
66 difference += current % 2;
67 current = current >> 1;
68 }
69 }
70
71 return difference;
72 }
73
74 Result Initialize()
75 {

Callers 2

HandleIncomingQueriesFunction · 0.85
TESTFunction · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68