Thread (4 messages) flat view 4 messages, 3 authors, 2023-08-04

Re: [PATCH v4 1/1] drm/i915: Move abs_diff() to math.h

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: 2023-08-04 04:07:35
Also in: dri-devel, intel-gfx, linux-serial, lkml

On Thu, Aug 03, 2023 at 10:24:46AM -0700, Andrew Morton wrote:
On Thu,  3 Aug 2023 16:19:18 +0300 Andy Shevchenko [off-list ref] wrote:
...
quoted
+#define abs_diff(a, b) ({			\
+	typeof(a) __a = (a);			\
+	typeof(b) __b = (b);			\
+	(void)(&__a == &__b);			\
+	__a > __b ? (__a - __b) : (__b - __a);	\
+})
Can we document it please?

Also, the open-coded type comparison could be replaced with __typecheck()?

And why the heck isn't __typecheck() in typecheck.h, to be included by
minmax.h.

etcetera.  Sigh.  I'll grab it, but please at least send along some
kerneldoc?
Sure and thank you!

-- 
With Best Regards,
Andy Shevchenko

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help