Fix documentation

Former-commit-id: bdaff1e4efaaad685df60baa0d11af3e7951dc4d [formerly 409b51215b894006fbcae285c8dfd67c97c9ae11] [formerly 58a176f2944bc3d347ccba58360cbdee3bb1b8d3 [formerly e6bd6b34212946c04eeec6896954c3969d1baf5f]]
Former-commit-id: 944b2ddd24acdcb0b6a5db07cfc75c13f407737a [formerly 7ed2f044fe8e50bf99a1c432e6079f7a445af573]
Former-commit-id: a1bfe55ac944ea530578a0cc813dd253cc708b69
This commit is contained in:
Gawaboumga
2016-08-21 13:49:24 +02:00
parent 9eba331f34
commit 24d7861380
4 changed files with 56 additions and 44 deletions

View File

@@ -45,20 +45,21 @@ namespace Nz
}
template<typename T>
// Les parenthèses autour de la condition sont nécesaires pour que GCC compile ça
// The parentheses are needed for GCC
typename std::enable_if<(sizeof(T) > sizeof(UInt32)), unsigned int>::type IntegralLog2(T number)
{
static_assert(sizeof(T) % sizeof(UInt32) == 0, "Assertion failed");
// L'algorithme pour le logarithme base 2 (au dessus) ne fonctionne qu'avec des nombres au plus 32bits
// ce code décompose les nombres plus grands en nombres 32 bits par masquage et bit shifting
// Masking and shifting bits to the right (to bring it back to 32 bits)
// Call of the function with 32 bits number, if the result is non-null we have our answer
for (int i = sizeof(T)-sizeof(UInt32); i >= 0; i -= sizeof(UInt32))
{
// Le masque 32 bits sur la partie du nombre qu'on traite actuellement
// The 32 bits mask on the part we are treating
T mask = T(std::numeric_limits<UInt32>::max()) << i*8;
T val = (number & mask) >> i*8; // Masquage et shifting des bits vers la droite (pour le ramener sur 32bits)
T val = (number & mask) >> i*8; // Masking and shifting bits to the right (to bring it back to 32 bits)
// Appel de la fonction avec le nombre 32bits, si le résultat est non-nul nous avons la réponse
// Call of the function with 32 bits number, if the result is non-null we have our answer
unsigned int log2 = IntegralLog2<UInt32>(val);
if (log2)
return log2 + i*8;
@@ -75,20 +76,20 @@ namespace Nz
}
template<typename T>
// Les parenthèses autour de la condition sont nécesaires pour que GCC compile ça
// The parentheses are needed for GCC
typename std::enable_if<(sizeof(T) > sizeof(UInt32)), unsigned int>::type IntegralLog2Pot(T number)
{
static_assert(sizeof(T) % sizeof(UInt32) == 0, "Assertion failed");
// L'algorithme pour le logarithme base 2 (au dessus) ne fonctionne qu'avec des nombres au plus 32bits
// ce code décompose les nombres plus grands en nombres 32 bits par masquage et bit shifting
// The algorithm for logarithm in base 2 only works with numbers greather than 32 bits
// This code subdivides the biggest number into 32 bits ones
for (int i = sizeof(T)-sizeof(UInt32); i >= 0; i -= sizeof(UInt32))
{
// Le masque 32 bits sur la partie du nombre qu'on traite actuellement
// The 32 bits mask on the part we are treating
T mask = T(std::numeric_limits<UInt32>::max()) << i*8;
UInt32 val = UInt32((number & mask) >> i*8); // Masquage et shifting des bits vers la droite (pour le ramener sur 32bits)
UInt32 val = UInt32((number & mask) >> i*8); // Masking and shifting bits to the right (to bring it back to 32 bits)
// Appel de la fonction avec le nombre 32bits, si le résultat est non-nul nous avons la réponse
// Call of the function with 32 bits number, if the result is non-null we have our answer
unsigned int log2 = IntegralLog2Pot<UInt32>(val);
if (log2 || val == 1)
return log2 + i*8;
@@ -99,7 +100,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Approaches the objective, beginning with value and with increment
* \return The nearest value of the objective you can get with the value and the increment for one step
*
@@ -121,7 +122,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Clamps value between min and max and returns the expected value
* \return If value is not in the interval of min..max, value obtained is the nearest limit of this interval
*
@@ -137,7 +138,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Gets number of bits set in the number
* \return The number of bits set to 1
*
@@ -160,7 +161,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Converts degree to radian
* \return The representation in radian of the angle in degree (0..2*pi)
*
@@ -174,7 +175,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Gets the unit from degree and convert it according to NAZARA_MATH_ANGLE_RADIAN
* \return Express the degrees
*
@@ -192,7 +193,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Gets the unit from radian and convert it according to NAZARA_MATH_ANGLE_RADIAN
* \return Express the radians
*
@@ -210,7 +211,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Gets the nearest power of two for the number
* \return First power of two containing the number
*
@@ -229,7 +230,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Gets the number of digits to represent the number in base 10
* \return Number of digits
*
@@ -257,7 +258,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Gets the number of digits to represent the number in base 10
* \return Number of digits
*
@@ -279,7 +280,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Gets the number of digits to represent the number in base 10
* \return Number of digits
*
@@ -295,7 +296,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Gets the number of digits to represent the number in base 10
* \return Number of digits
*
@@ -312,7 +313,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Gets the number of digits to represent the number in base 10
* \return Number of digits
*
@@ -328,7 +329,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Gets the number of digits to represent the number in base 10
* \return Number of digits
*
@@ -345,7 +346,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Gets the number of digits to represent the number in base 10
* \return Number of digits + 1 for the dot
*
@@ -360,7 +361,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Gets the number of digits to represent the number in base 10
* \return Number of digits + 1 for the dot
*
@@ -375,7 +376,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Gets the number of digits to represent the number in base 10
* \return Number of digits + 1 for the dot
*
@@ -390,7 +391,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Gets the log in base 2 of integral number
* \return Log of the number (floor)
*
@@ -408,7 +409,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Gets the log in base 2 of integral number, only works for power of two !
* \return Log of the number
*
@@ -426,7 +427,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Gets the power of integrals
* \return base^exponent for integral
*
@@ -445,7 +446,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Interpolates the value to other one with a factor of interpolation
* \return A new value which is the interpolation of two values
*
@@ -466,7 +467,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Multiplies X and Y, then add Z
* \return The result of X * Y + Z
*
@@ -508,7 +509,7 @@ namespace Nz
#endif
/*!
* \ingroup math
* \ingroup math
* \brief Normalizes the angle
* \return Normalized value between 0..2*(pi if radian or 180 if degrees)
*
@@ -534,7 +535,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Checks whether two numbers are equal
* \return true if they are equal within a certain epsilon
*
@@ -550,7 +551,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Checks whether two numbers are equal
* \return true if they are equal within the max difference
*
@@ -571,7 +572,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Converts the number to String
* \return String representation of the number
*
@@ -623,7 +624,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Converts radian to degree
* \return The representation in degree of the angle in radian (0..360)
*
@@ -637,7 +638,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Converts the string to number
* \return Number which is represented by the string
*
@@ -699,7 +700,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Gets the degree from unit and convert it according to NAZARA_MATH_ANGLE_RADIAN
* \return Express in degrees
*
@@ -717,7 +718,7 @@ namespace Nz
}
/*!
* \ingroup math
* \ingroup math
* \brief Gets the radian from unit and convert it according to NAZARA_MATH_ANGLE_RADIAN
* \return Express in radians
*