summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsigsegv7 <ian@vegaa.systems>2023-09-17 07:25:44 -0400
committersigsegv7 <ian@vegaa.systems>2023-09-17 07:25:44 -0400
commit3a03072abfaab683337c54922feca3d5cb096254 (patch)
treeb67dd5b1c644e73af9525afdbfe49decde6855c6
parent31ca14fd12f92a7a333a33e6d3b06c90652c6678 (diff)
Optimize step decrementation logic
Signed-off-by: sigsegv7 <ian@vegaa.systems>
-rw-r--r--main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/main.c b/main.c
index 1eef5eb..b889ec2 100644
--- a/main.c
+++ b/main.c
@@ -89,7 +89,8 @@ encrypt(char *buf, size_t buf_size)
/* Ensure we don't cause any overflows */
while (((current_pos + step) >= buf_size) && step > 1)
- step /= 2;
+ /* Essentially divide the step by 2, just faster */
+ step >>= 1;
}
}