diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-12 05:31:00 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-12 05:31:44 +0000 |
| commit | 24796333680e03884b77595c386cc2d6f2aa4f62 (patch) | |
| tree | b0d102f69f3c511aceaf6d0b397d4e80c0e09335 /util/sbase/queue.h | |
| parent | e23cecb496d8345d728bb8429b95a9aa564b9148 (diff) | |
util/spkmodem-recv: optimise pulse check
the last change was good, but this code, again,
has to do these calculations 48,000 times a second.
trivial on new computers. but now try it on a
computer from 1992.
we should try to make this as fast as possible :)
older compilers especially don't optimise these
checks. this patch shifts it to one subtraction and
one unsigned comparison, rather than checking less
than or greater than both. often used in... literally
exactly this type of program.
on a good compiler this will compile to an add, cmp
and conditional jump.
less readable, but the results (set 1 or 0) make it
pretty obvious what it does, after a few seconds.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/sbase/queue.h')
0 files changed, 0 insertions, 0 deletions
