diff options
author | Rose <83477269+AtariDreams@users.noreply.github.com> | 2023-12-19 17:19:38 +0100 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2023-12-22 14:45:55 +0100 |
commit | d6e4056805f54bb1a0ef41fa3a6a35b70c94edba (patch) | |
tree | 58b57d150d3350b7702df80bf0d327a6474fa528 /crypto | |
parent | Remove uneeded cast to unsigned int (diff) | |
download | openssl-d6e4056805f54bb1a0ef41fa3a6a35b70c94edba.tar.xz openssl-d6e4056805f54bb1a0ef41fa3a6a35b70c94edba.zip |
Optimize circular buffer to avoid modulo
CLA: trivial
Avoid doing the division via modulo where possible.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23097)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/bio/bio_dump.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/bio/bio_dump.c b/crypto/bio/bio_dump.c index c453da6268..40c18410e4 100644 --- a/crypto/bio/bio_dump.c +++ b/crypto/bio/bio_dump.c @@ -141,9 +141,10 @@ int BIO_hex_string(BIO *out, int indent, int width, const void *data, BIO_printf(out, "%02X:", d[i]); - j = (j + 1) % width; - if (!j) + if (++j >= width) { + j = 0; BIO_printf(out, "\n"); + } } if (i && !j) |