[rds-devel] [PATCH 6/9] RDS: Fix ordering in a conditional
Andrew Grover
andy.grover at gmail.com
Mon Mar 30 23:56:14 PDT 2009
On Mon, Mar 30, 2009 at 9:27 PM, Roland Dreier <rdreier at cisco.com> wrote:
> > - if (0 <= ret && (unsigned) ret < nr_pages) {
> > + if (ret > 0 && (unsigned) ret < nr_pages) {
>
> This is not an equivalent transformation -- the original code is true if
> ret == 0, while the new code is false.
Ah! Good point.
> Also it seems you don't need the unsigned cast here, since the clause
> before just checked that ret is positive?
True, but I'd bet the compiler will warn if we remove it. I'll try it
tomorrow and see.
Thanks! -- Regards -- Andy
More information about the rds-devel
mailing list