diff options
author | zugz (tox) <mbays+tox@sdf.org> | 2020-02-28 00:00:00 +0000 |
---|---|---|
committer | zugz (tox) <mbays+tox@sdf.org> | 2020-03-14 00:00:02 +0000 |
commit | c644ef76810f8db61bce3f52d36a1a6a25e47683 (patch) | |
tree | 1a4c5ed13f1a3450e3a005746ba6bb0d1af7beaf /toxcore/net_crypto.c | |
parent | e6714909898d7e5fe6b35b6d109e584e6c5858b0 (diff) |
use -1 rather than ~0 in unsigned integer types
Using ~0 involves a bitwise operation on int, so depends on
the internal representation of signed integers.
Diffstat (limited to 'toxcore/net_crypto.c')
-rw-r--r-- | toxcore/net_crypto.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index 01dd680e..09ce91ba 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c | |||
@@ -1004,7 +1004,7 @@ static int handle_request_packet(Mono_Time *mono_time, const Logger *log, Packet | |||
1004 | uint32_t requested = 0; | 1004 | uint32_t requested = 0; |
1005 | 1005 | ||
1006 | const uint64_t temp_time = current_time_monotonic(mono_time); | 1006 | const uint64_t temp_time = current_time_monotonic(mono_time); |
1007 | uint64_t l_sent_time = ~0; | 1007 | uint64_t l_sent_time = -1; |
1008 | 1008 | ||
1009 | for (uint32_t i = send_array->buffer_start; i != send_array->buffer_end; ++i) { | 1009 | for (uint32_t i = send_array->buffer_start; i != send_array->buffer_end; ++i) { |
1010 | if (length == 0) { | 1010 | if (length == 0) { |
@@ -2513,7 +2513,7 @@ static void send_crypto_packets(Net_Crypto *c) | |||
2513 | { | 2513 | { |
2514 | const uint64_t temp_time = current_time_monotonic(c->mono_time); | 2514 | const uint64_t temp_time = current_time_monotonic(c->mono_time); |
2515 | double total_send_rate = 0; | 2515 | double total_send_rate = 0; |
2516 | uint32_t peak_request_packet_interval = ~0; | 2516 | uint32_t peak_request_packet_interval = -1; |
2517 | 2517 | ||
2518 | for (uint32_t i = 0; i < c->crypto_connections_length; ++i) { | 2518 | for (uint32_t i = 0; i < c->crypto_connections_length; ++i) { |
2519 | Crypto_Connection *conn = get_crypto_connection(c, i); | 2519 | Crypto_Connection *conn = get_crypto_connection(c, i); |
@@ -2722,7 +2722,7 @@ static void send_crypto_packets(Net_Crypto *c) | |||
2722 | } | 2722 | } |
2723 | } | 2723 | } |
2724 | 2724 | ||
2725 | c->current_sleep_time = ~0; | 2725 | c->current_sleep_time = -1; |
2726 | uint32_t sleep_time = peak_request_packet_interval; | 2726 | uint32_t sleep_time = peak_request_packet_interval; |
2727 | 2727 | ||
2728 | if (c->current_sleep_time > sleep_time) { | 2728 | if (c->current_sleep_time > sleep_time) { |