diff options
author | Keuin <[email protected]> | 2022-05-28 13:39:51 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2022-05-28 13:39:51 +0800 |
commit | db89021276d9d501dbb6f8a0485d4b5754113b7f (patch) | |
tree | f8b4c0d096a147a464ec4c6a5abdb9edaec21e6a | |
parent | 2718019bef355092a2f5e10f33c6002a1c261c2b (diff) |
Optimization: reduce checking stop_signal.
-rw-r--r-- | main.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -60,8 +60,10 @@ bool yield_possible_key( uint64_t plaintext; char key[8]; symmetric_key skey; + /* check `stop_signal` after every 256 round of loop */ + uint8_t check_stop = 0; do { - if ((b != 0 && k >= b) || atomic_load(stop_signal)) { + if ((b != 0 && k >= b) || (!check_stop++ && atomic_load(stop_signal))) { // out of range, stop ctx->finished = true; return false; |