mas-bandwidth / netcode

Secure client/server connections over UDP
BSD 3-Clause "New" or "Revised" License
2.43k stars 191 forks source link

Fix clang warning about signed/unsigned comparison #106

Closed jorgenpt closed 3 years ago

jorgenpt commented 3 years ago

netcode_replay_protection_t::received_packet[N] is uint64_t, and it was being compared to a signed literal (0xFFFFFFFFFFFFFFFFLL), causing the following warning:

warning: comparison of integers of different signs: 'uint64_t' (aka 'unsigned long long') and 'long long' [-Wsign-compare]
    if ( replay_protection->received_packet[index] == 0xFFFFFFFFFFFFFFFFLL )

This switches the literal for UINT64_MAX, which is a constant for the unsigned version of the same literal.