From 1c68979fb4b147d58b5430e110cb1dece6eb122a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 5 Nov 2018 19:19:18 +0100 Subject: [PATCH] Move wxCTZ() documentation to the appropriate place The documentation comment belongs to interface/wx/math.h, not the header under include. Also change the argument type to wxUint32 as the non-gcc version only works for 32 bit values. --- include/wx/math.h | 13 +++---------- interface/wx/math.h | 13 +++++++++++++ src/common/utilscmn.cpp | 2 +- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/include/wx/math.h b/include/wx/math.h index 8f5e9ddc56..261969d364 100644 --- a/include/wx/math.h +++ b/include/wx/math.h @@ -150,6 +150,9 @@ inline int wxRound(double x) inline double wxDegToRad(double deg) { return (deg * M_PI) / 180.0; } inline double wxRadToDeg(double rad) { return (rad * 180.0) / M_PI; } +// Count trailing zeros. +WXDLLIMPEXP_BASE unsigned int wxCTZ(wxUint32 x); + #endif /* __cplusplus */ @@ -181,14 +184,4 @@ inline double wxRadToDeg(double rad) { return (rad * 180.0) / M_PI; } /* Compute the greatest common divisor of two positive integers */ WXDLLIMPEXP_BASE unsigned int wxGCD(unsigned int u, unsigned int v); -#ifdef __cplusplus -/* Count trailing zeros - -Returns the number of trailing zeros in unsigned input x. - -@since 3.1.2 -*/ -WXDLLIMPEXP_BASE unsigned int wxCTZ(unsigned x); -#endif - #endif /* _WX_MATH_H_ */ diff --git a/interface/wx/math.h b/interface/wx/math.h index ca11a9fff2..b1486c270c 100644 --- a/interface/wx/math.h +++ b/interface/wx/math.h @@ -75,6 +75,19 @@ double wxDegToRad(double deg); */ double wxRadToDeg(double rad); +/** + Count the number of trailing zeros. + + This function returns the number of trailing zeros in the binary notation + of its argument @a x. E.g. for @a x equal to 4, or 0b100, the return value + is 2. + + @param x Strictly positive, i.e. non-zero, 32 bit number. + + @since 3.1.2 + */ +unsigned int wxCTZ(wxUint32 x); + /** Small wrapper around round(). */ diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index 23324e28e6..456dc1b38a 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -1021,7 +1021,7 @@ unsigned int wxGCD(unsigned int u, unsigned int v) // wxCTZ // Count trailing zeros. Use optimised builtin where available. // ---------------------------------------------------------------------------- -unsigned int wxCTZ(unsigned x) +unsigned int wxCTZ(wxUint32 x) { wxCHECK_MSG(x > 0, 0, "Undefined for x == 0."); #ifdef __GNUC__