mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-21 14:56:18 +00:00
lib/igt.cocci: Deal with min/max/swap
Replace open coded min/max/swap with the macro invocation. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
This commit is contained in:
parent
1658edceee
commit
e1bdab9973
@ -91,3 +91,39 @@ expression E;
|
|||||||
@@
|
@@
|
||||||
- assert(E);
|
- assert(E);
|
||||||
+ igt_assert(E);
|
+ igt_assert(E);
|
||||||
|
|
||||||
|
// Replace open-coded swap()
|
||||||
|
@@
|
||||||
|
type T;
|
||||||
|
T a, b, tmp;
|
||||||
|
@@
|
||||||
|
- tmp = a;
|
||||||
|
- a = b;
|
||||||
|
- b = tmp;
|
||||||
|
+ swap(a, b);
|
||||||
|
|
||||||
|
// Replace open-coded min()
|
||||||
|
@@
|
||||||
|
expression a;
|
||||||
|
expression b;
|
||||||
|
@@
|
||||||
|
(
|
||||||
|
- ((a) < (b) ? (a) : (b))
|
||||||
|
+ min(a, b)
|
||||||
|
|
|
||||||
|
- ((a) <= (b) ? (a) : (b))
|
||||||
|
+ min(a, b)
|
||||||
|
)
|
||||||
|
|
||||||
|
// Replace open-coded max()
|
||||||
|
@@
|
||||||
|
expression a;
|
||||||
|
expression b;
|
||||||
|
@@
|
||||||
|
(
|
||||||
|
- ((a) > (b) ? (a) : (b))
|
||||||
|
+ max(a, b)
|
||||||
|
|
|
||||||
|
- ((a) >= (b) ? (a) : (b))
|
||||||
|
+ max(a, b)
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user