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:
parent
9eba331f34
commit
24d7861380
|
|
@ -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