diff options
author | irungentoo <irungentoo@gmail.com> | 2015-03-14 10:03:19 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2015-03-14 10:03:19 -0400 |
commit | a1127e63d5f630720be6cf6ecef9d799e94f319f (patch) | |
tree | 4aa511167423d89df8d0d96ce9383280f8332492 | |
parent | 11e8e8bd3a8dfc6f94ccecda5b1b98848b09e9ec (diff) |
Better DHT distance function.
-rw-r--r-- | toxcore/DHT.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/toxcore/DHT.c b/toxcore/DHT.c index 2d3d6ffe..9ebe11cf 100644 --- a/toxcore/DHT.c +++ b/toxcore/DHT.c | |||
@@ -78,8 +78,8 @@ int id_closest(const uint8_t *id, const uint8_t *id1, const uint8_t *id2) | |||
78 | 78 | ||
79 | for (i = 0; i < CLIENT_ID_SIZE; ++i) { | 79 | for (i = 0; i < CLIENT_ID_SIZE; ++i) { |
80 | 80 | ||
81 | distance1 = abs(((int8_t *)id)[i] ^ ((int8_t *)id1)[i]); | 81 | distance1 = id[i] ^ id1[i]; |
82 | distance2 = abs(((int8_t *)id)[i] ^ ((int8_t *)id2)[i]); | 82 | distance2 = id[i] ^ id2[i]; |
83 | 83 | ||
84 | if (distance1 < distance2) | 84 | if (distance1 < distance2) |
85 | return 1; | 85 | return 1; |