Dne Ätvrtek 27 Leden 2011 19:47:41 Dave Anderson napsal(a):
----- Original Message -----
> Hi Dave,
>
> > BTW, was there a reason that you changed this?:
> > if (si->c_flags & SLAB_CFLGS_BUFCTL)
> >
> > - obj = si->s_mem + ((next - si->s_index) * si->c_offset);
> > + obj = si->s_mem + (next - si->s_index) * si->c_offset;
>
> It wasn't my patch so I'm only offering my ACK for the original change
> and my reason is that multiply has higher operator precedence than add
> (and subtract) in normal arithmetic so the outer parentheses were
> never necessary anyway. They didn't create an error but they weren't
> needed either. The inner parentheses are required.
>
> --
> David Mair.
Right I understand that, but the sources are full of such
"extra" parentheses, some to prevent compiler warnings, but
mostly just for ease of maintainability/understanding.
I just was wondering why that line was explicitly changed.
No reason, except I removed them for some reason while developing the patch
and forgot to put them back afterwards. I can leave it as-is.
Oh, I've just realized that this actually changed the expression, because
originally both variables were pointers to ulong, so
(next - si->s_index)
should become
((next - si->s_index)/sizeof(ulong))
I wonder whether this was originally intended. Let me have one more look at
this.
Petr