Fix documentation
Former-commit-id: c11854f38304c8c1db43d740b85d262f999e960d [formerly 1a02bb65c7dd7a3fdcef9f2efed1aa041365b929] [formerly 86ec65871b28639a3a475671297ebef6e75833a5 [formerly e5064e4cd1661344b3beb785d085756deb3dccf4]] Former-commit-id: 09a97462c981a214dcd274047c5057805bb9aca4 [formerly 1f0c58d1b2e3e0641d50cf113809c3c11a1cc500] Former-commit-id: cb2e1f2b5c9cd84124eaab9c401076fa4a586858
This commit is contained in:
parent
c8c19f5845
commit
1f7dd1dae4
|
|
@ -45,20 +45,21 @@ namespace Nz
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
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)
|
typename std::enable_if<(sizeof(T) > sizeof(UInt32)), unsigned int>::type IntegralLog2(T number)
|
||||||
{
|
{
|
||||||
static_assert(sizeof(T) % sizeof(UInt32) == 0, "Assertion failed");
|
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
|
// Masking and shifting bits to the right (to bring it back to 32 bits)
|
||||||
// ce code décompose les nombres plus grands en nombres 32 bits par masquage et bit shifting
|
|
||||||
|
// 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))
|
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 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);
|
unsigned int log2 = IntegralLog2<UInt32>(val);
|
||||||
if (log2)
|
if (log2)
|
||||||
return log2 + i*8;
|
return log2 + i*8;
|
||||||
|
|
@ -75,20 +76,20 @@ namespace Nz
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
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)
|
typename std::enable_if<(sizeof(T) > sizeof(UInt32)), unsigned int>::type IntegralLog2Pot(T number)
|
||||||
{
|
{
|
||||||
static_assert(sizeof(T) % sizeof(UInt32) == 0, "Assertion failed");
|
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
|
// The algorithm for logarithm in base 2 only works with numbers greather than 32 bits
|
||||||
// ce code décompose les nombres plus grands en nombres 32 bits par masquage et bit shifting
|
// This code subdivides the biggest number into 32 bits ones
|
||||||
for (int i = sizeof(T)-sizeof(UInt32); i >= 0; i -= sizeof(UInt32))
|
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 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);
|
unsigned int log2 = IntegralLog2Pot<UInt32>(val);
|
||||||
if (log2 || val == 1)
|
if (log2 || val == 1)
|
||||||
return log2 + i*8;
|
return log2 + i*8;
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ namespace Nz
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Initializes the sprite librairies
|
* \brief Initializes the sprite library
|
||||||
* \return true If successful
|
* \return true If successful
|
||||||
*
|
*
|
||||||
* \remark Produces a NazaraError if the sprite library failed to be initialized
|
* \remark Produces a NazaraError if the sprite library failed to be initialized
|
||||||
|
|
@ -93,7 +93,7 @@ namespace Nz
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Uninitializes the sprite librairies
|
* \brief Uninitializes the sprite library
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void Sprite::Uninitialize()
|
void Sprite::Uninitialize()
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,13 @@ namespace Nz
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Initializes the tilemap library
|
||||||
|
* \return true If successful
|
||||||
|
*
|
||||||
|
* \remark Produces a NazaraError if the tilemap library failed to be initialized
|
||||||
|
*/
|
||||||
|
|
||||||
bool TileMap::Initialize()
|
bool TileMap::Initialize()
|
||||||
{
|
{
|
||||||
if (!TileMapLibrary::Initialize())
|
if (!TileMapLibrary::Initialize())
|
||||||
|
|
@ -101,6 +108,10 @@ namespace Nz
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Uninitializes the tilemap library
|
||||||
|
*/
|
||||||
|
|
||||||
void TileMap::Uninitialize()
|
void TileMap::Uninitialize()
|
||||||
{
|
{
|
||||||
TileMapLibrary::Uninitialize();
|
TileMapLibrary::Uninitialize();
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ namespace Nz
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Uninitializes the Core module
|
* \brief Uninitializes the Network module
|
||||||
*
|
*
|
||||||
* \remark Produces a NazaraNotice
|
* \remark Produces a NazaraNotice
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue