Skip to content

Fix clang warning about signed/unsigned comparison#106

Merged
gafferongames merged 1 commit intomas-bandwidth:masterfrom
jorgenpt:fix-signed-unsigned-comparison-warning
Aug 27, 2021
Merged

Fix clang warning about signed/unsigned comparison#106
gafferongames merged 1 commit intomas-bandwidth:masterfrom
jorgenpt:fix-signed-unsigned-comparison-warning

Conversation

@jorgenpt
Copy link
Contributor

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.

`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.
@gafferongames gafferongames merged commit 110578c into mas-bandwidth:master Aug 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants