[PATCH 01/12] filter: Minor optimizations, code cleanups in value comparison
Ondrej Zajicek
santiago at crfreenet.org
Thu Oct 3 13:06:29 CEST 2013
On Mon, Sep 30, 2013 at 09:22:15PM +0300, Sergey Popovich wrote:
> * Add minor optimisations on speed when comparing with int_cmp(),
> uint_cmp(), u64_cmp(), by removing branching.
Applied, thanks.
Although i replaced
return (i1 > i2) - (i1 < i2);
by
return (int)(i1 > i2) - (int)(i1 < i2);
Former depends on proper overflow when uint is converted to int,
which would probably works (as we use -fno-strict-overflow).
> * Reorder type checks in val_compare() and val_in_range().
I skipped this as i simplified set matching in val_in_range()
anyways.
val_in_range() could be changed to use switch based on the type of
the second argument, question is whether efficiency gains are large
enough to outweight loses in readability.
--
Elen sila lumenn' omentielvo
Ondrej 'SanTiago' Zajicek (email: santiago at crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20131003/eaae7982/attachment.asc>
More information about the Bird-users
mailing list