Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux

On Wed, 24 Jul 2013, Taylor R Campbell wrote:
Modified Files:
        src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: kernel.h

Log Message:
Implement bogus max_t in <linux/kernel.h>.

+/* XXX These will multiply evaluate their arguments.  */
+#define        max_t(T, X, Y)  MAX(X, Y)
#define min_t(T, X, Y)  MIN(X, Y)

If we are willing to use the non-standard ({ ... }) syntax, then these can be written to evaluate their arguments only once, like this:

    #define max_t(T, X, Y) ({ T _x = (X), _y = (Y); (_x > _y ? _x : _y); })
    #define min_t(T, X, Y) ({ T _x = (X), _y = (Y); (_x < _y ? _x : _y); })

--apb (Alan Barrett)

Home | Main Index | Thread Index | Old Index