| Age | Commit message (Collapse) | Author |
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
may break on modern systems (macro)
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
a bit dirty. should handle this at runtime.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
when i removed arc4random integration, i forgot
to change this line back. oops!
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
i was editting this in another editor
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
only use the old fallback, or /dev/urandom
/dev/random blocks on some older unix machines,
or in embedded environments that may never
have enough entropy, causing the code to hang.
urandom is most certainly expected to exist on
pretty much anything since the mid 90s.
i could probably re-add the arc4random setup
for BSDs. i'll think about it. gotta do that
portably too.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
if someone calls rhex fast enough, the timestamp
may not change. this mitigates that by adding
a counter value to the mix
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
used when a random device isn't available, on old
unix, or on certain chroot environments.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
one for directory, then copy the binary
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
forgot to include the binary in the path
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
may break modern systems. and all old systems that
i care about will handle errno just fine.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
-p isn't portable
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
yeah, why not use a tool that's been around since the
80s?
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
also support LDFLAGS
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
forgot this. oops
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
disable random mac address generation on really old
operating systems.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
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>
|
|
i turned this into abs() call earlier, but this isn't
obviously readable by some people.
make it absolutely clear what this does. also reduces
use of syscalls.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
replace the err call in getopt
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
more knf-compliant
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
fread() may return short reads, whereas the current
code assumes either EOF or a full read.
change if to a while. really, it's that simple.
just loop until it's done. i probably b0rked this
myself when refactoring the GNU code.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
i treated ftell errors as fatal, but if fttell fails
with ESPIPE, and someone's using -d, the program may
exit immediately, even though there's no problem.
instead, skip printing the offset (basically no debug).
this fixes a bug that i introduced myself, when i forked
this code, because i added that error check; the GNU
code didn't have any check whatsoever.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
we currently read small amounts of data with fread,
repeatedly, which is quite taxing on the CPU, on
very old systems.
48khz audio. 48000 calls to fread() per second?
yeah. let's optimise this.
performance now should be roughly O(1) in practise.
this and the other recent changes means no modulo
or division, reduced branching, memory memory roads,
and lots of buffering.
the buffering here is quite conservative, so the human
won't notice any difference. we're cutting the number
of times we call fread by a factor of several thousand,
but you'll still see text scrolling down pretty quick,
with minimal lag.
the old GNU code i forked was terrible at this.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
make it clearer about next/old, in the loop. this also
improves performance on older systems (cache the values
first, don't re-calculate)
again, this is GNU code. but you wouldn't know it, in my
current version. i forked this from GRUB several years
ago and started cleaning it for fun.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
the signal check should be its own function,
for clearer understanding
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
frame handling, error checks, pulse decoding and
character decoding are all jumbled up. this patch
separates them a bit, making it clearer.
should also help codegen. this tool is dealing with
high bandwidth text, which on slower computers may
be cumbersome. every optimisation counts.
not really relevant on newer systems.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
instead of computing next every time, just advance
two indexes. another performance optimisation on
older machines, especially old compilers, because
it reduces the amount of logical branching.
the old code was pretty much just advancing two
indexes in lockstep, when getting the next pulse,
but recalculating one of them based on the other,
each time.
this is yet another hangover from the old GNU code
that i forked three years ago.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
it's slow on older compilers/systems that don't optimise.
instead, we branch (cheaper) and just do an above or
equal comparison), resetting appropriately or subtracting.
should yield an actually useful performance gain, on older
systems. a bit theoretical on modern systems, which optimise
well (modern compilers will produce assembly code much like
what the new C code is doing)
Signed-off-by: Leah Rowe <leah@libreboot.org>
|