Bug 12722 - Use MIN and MAX instead of if statements
Summary: Use MIN and MAX instead of if statements
Status: RESOLVED WONTFIX
Alias: None
Product: cairo
Classification: Unclassified
Component: general (show other bugs)
Version: 1.5.1
Hardware: Other All
: medium normal
Assignee: Carl Worth
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-06 21:16 UTC by Björn Lindqvist
Modified: 2012-04-14 07:48 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Use MIN and MAX instead of if statements (5.63 KB, patch)
2007-10-06 21:17 UTC, Björn Lindqvist
Details | Splinter Review

Description Björn Lindqvist 2007-10-06 21:16:24 UTC
Quite a few places in cairo uses code like the following:

  if (a > b)
      b = a;

That code is functionally equivalent to:

  b = MAX (a, b);

Which is a more succinct, readable and less error pone version of the above. So, here is a patch that replaces all instances of the first idiom with the latter.
Comment 1 Björn Lindqvist 2007-10-06 21:17:17 UTC
Created attachment 11923 [details] [review]
Use MIN and MAX instead of if statements
Comment 2 Chris Wilson 2012-04-14 07:48:12 UTC
But I didn't like the shouting.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.