From: Pyry Haulos Date: Fri, 11 Dec 2015 22:20:53 +0000 (-0800) Subject: Add deIsPowerOfTwo64 X-Git-Tag: upstream/0.1.0~1333 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f0cae7f05f80b99386bd8e897d4865965df138c6;p=platform%2Fupstream%2FVK-GL-CTS.git Add deIsPowerOfTwo64 Change-Id: I2a3c40fe727c49f944e7608bc283eae4dd454dcc --- diff --git a/framework/delibs/debase/deInt32.h b/framework/delibs/debase/deInt32.h index 4806fe6..6550267 100644 --- a/framework/delibs/debase/deInt32.h +++ b/framework/delibs/debase/deInt32.h @@ -206,6 +206,18 @@ DE_INLINE deBool deIsPowerOfTwo32 (int a) } /*--------------------------------------------------------------------*//*! + * \brief Check if a value is a power-of-two. + * \param a Input value. + * \return True if input is a power-of-two value, false otherwise. + * + * \note Also returns true for zero. + *//*--------------------------------------------------------------------*/ +DE_INLINE deBool deIsPowerOfTwo64 (deUint64 a) +{ + return ((a & (a - 1ull)) == 0); +} + +/*--------------------------------------------------------------------*//*! * \brief Check if an integer is aligned to given power-of-two size. * \param a Input value. * \param align Alignment to check for.