summaryrefslogtreecommitdiffstats
path: root/crypto/bio
diff options
context:
space:
mode:
authorRose <83477269+AtariDreams@users.noreply.github.com>2023-12-19 11:19:38 -0500
committerTomas Mraz <tomas@openssl.org>2023-12-22 14:45:55 +0100
commitd6e4056805f54bb1a0ef41fa3a6a35b70c94edba (patch)
tree58b57d150d3350b7702df80bf0d327a6474fa528 /crypto/bio
parent6e155858d785297bd8b51f667bc440f4e7c17bfb (diff)
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/bio')
-rw-r--r--crypto/bio/bio_dump.c5
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)