From b6ba4ac00d1ea86bb1a735391f03fd6ea9e464b1 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 25 Mar 2014 16:16:57 +0100 Subject: Unduplicate the implementations of next power of two Qtbase contains four identical implementations of next power of two, these should be shared and the implementation made available to other qt modules, as it is also used many places outside of qtbase. [ChangeLog][QtCore][QtMath] Introduced qNextPowerOfTwo methods. Change-Id: Id23fbe5ad6bae647b30d5a4212c0330e48a50278 Reviewed-by: Thiago Macieira --- src/corelib/kernel/qmath.qdoc | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/corelib/kernel/qmath.qdoc') diff --git a/src/corelib/kernel/qmath.qdoc b/src/corelib/kernel/qmath.qdoc index 04dbbb0a3b..430a420eeb 100644 --- a/src/corelib/kernel/qmath.qdoc +++ b/src/corelib/kernel/qmath.qdoc @@ -215,4 +215,37 @@ \snippet code/src_corelib_kernel_qmath.cpp 3 \sa qDegreesToRadians() + +/*! + \fn quint32 qNextPowerOfTwo(quint32 value) + \relates + \since 5.4 + + This function returns the nearest power of two greater than \a value. For 0 it returns 1, and for values larger than or equal to 2^31 it returns 0. +*/ + +/*! + \fn quint32 qNextPowerOfTwo(qint32 value) + \relates + \since 5.4 + \overload + + This function returns the nearest power of two greater than \a value. For negative values it returns 0. +*/ + +/*! + \fn quint64 qNextPowerOfTwo(quint64 value) + \relates + \since 5.4 + + This function returns the nearest power of two greater than \a value. For 0 it returns 1, and for values larger than or equal to 2^63 it returns 0. +*/ + +/*! + \fn quint64 qNextPowerOfTwo(qint64 value) + \relates + \since 5.4 + \overload + + This function returns the nearest power of two greater than \a value. For negative values it returns 0. */ -- cgit v1.2.3