Bug 12722

Summary: Use MIN and MAX instead of if statements
Product: cairo Reporter: Björn Lindqvist <bjourne>
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED WONTFIX QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: 1.5.1   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Use MIN and MAX instead of if statements

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.