diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-03-25 16:16:57 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-06-26 00:47:51 +0200 |
commit | b6ba4ac00d1ea86bb1a735391f03fd6ea9e464b1 (patch) | |
tree | 4782bad29fe72a9a9e93a044eb93c2e2bd5a1a32 /src/corelib/kernel/qmath.qdoc | |
parent | ef077750ce47212570c9bc1ce6367309678440f6 (diff) |
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 <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qmath.qdoc')
-rw-r--r-- | src/corelib/kernel/qmath.qdoc | 33 |
1 files changed, 33 insertions, 0 deletions
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 <QtMath> + \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 <QtMath> + \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 <QtMath> + \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 <QtMath> + \since 5.4 + \overload + + This function returns the nearest power of two greater than \a value. For negative values it returns 0. */ |