Re: [PATCH] ifplugd: using the __builtin_expect?
Maksym Kryzhanovskyy
xmaks at email.cz
Thu Jul 8 09:02:10 UTC 2010
On 08.7.2010 02:37:35, Denys Vlasenko wrote:
> On Wednesday 07 July 2010 12:58, Maksym Kryzhanovskyy wrote:
> > Hi Denis,
> >
> > can we use the __builtin_expect function in busybox?
> > In the previous patch for ifplugd it might be usefull
> > (see attachment).
>
> - if (!G.detect_link_func) {
> + if (__builtin_expect(G.detect_link_func == NULL, 0)) {
>
> I don't see any changes in size, only obfuscated code.
Yes, it's not for reducing the size of ifplugd, but we wanted to ask gcc to
optimize the if statment for a negative result (moreover, it costs nothing in
terms of size):
if (!G.detect_link_func) { // predominantly negative throughout life of ifplugd
This may be unlikely() if it is more readable as Marek Polacek
and Bernhard Fischer-Reutner offers:
#define unlikely(x) __builtin_expect(!!(x), 0)
if (unlikely(G.detect_link_func == NULL)) {
If it is actually needed..
Max.
> --
> vda
>
>
>
More information about the busybox
mailing list