From: Linus Torvalds > Sent: 20 March 2019 17:26 > To: David Laight > On Wed, Mar 20, 2019 at 4:17 AM David Laight <david.lai...@aculab.com> wrote: > > > > > ______r = !!(cond); \ > > > > Is that (or maybe just the !!) needed any more?? > > It is, because the 'cond' expression might not be an int, it could be > a test for a pointer being non-NULL, or an u64 being non-zero, and not > having the "!!" would mean that you'd get a warning or drop bits when > assigning to 'int'. > > And you do need the new temporary variable to avoid double evaluation > the way that code is written.
As usual I'd opened my mouth before checking the full context :-) > ______r = !!(cond); > - ______f.miss_hit[______r]++; > \ > + ______r ? ______f.miss_hit[1]++ : ______f.miss_hit[0]++;\ > ______r; \ Actually you can avoid double evaluation by doing: (cond) ? (______f.miss_hit[1]++, 1) : (______f.miss_hit[0]++, 0) With luck the compiler will move the increment to after the branch target. for (_____ = ____; _____ < ______; _____++) :-) David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)