Optimize main loop in find_bytestr()
commit738b52aa2f7921062f3aa14c6c2c78205ade9300
authorPetr Tesarik <petr@tesarici.cz>
Mon, 1 Oct 2012 09:03:28 +0000 (1 11:03 +0200)
committerPetr Tesarik <petr@tesarici.cz>
Mon, 1 Oct 2012 09:03:28 +0000 (1 11:03 +0200)
tree5ff489daa009b01b755143da3776fd212d29f09e
parentf813a4f5e854e29a73d371ee1950e134ddd3e130
Optimize main loop in find_bytestr()

The only reason for keeping the "remain" variable a hed_off_t is that
it the 0..SIZE_MAX range is used for forward searches and -SIZE_MAX..0
is used for backward searches. For all practical purposes, the segment
size can be limited to SSIZE_MAX. This allows me to use ssize_t instead,
which performs better on 32-bit architectures.

As a bonus, I can use move_rel_fast() for the final cursor move.
libhed/file.c