optimized hgl_align/hgl_align_pow2 functions.
This commit is contained in:
parent
8f184a87fb
commit
3d27b60c13
@ -192,7 +192,7 @@ namespace hgl
|
|||||||
* 求数值对齐后的值
|
* 求数值对齐后的值
|
||||||
*/
|
*/
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline T hgl_align(const T &value,const T &alignment)
|
inline T hgl_align(const T value,const T alignment)
|
||||||
{
|
{
|
||||||
return ((value+alignment-1)/alignment)*alignment;
|
return ((value+alignment-1)/alignment)*alignment;
|
||||||
}
|
}
|
||||||
@ -201,7 +201,7 @@ namespace hgl
|
|||||||
* 求数值对齐后的值(仅支持2次幂)
|
* 求数值对齐后的值(仅支持2次幂)
|
||||||
*/
|
*/
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline T hgl_align_pow2(const T &value,const T &alignment)
|
inline T hgl_align_pow2(const T value,const T alignment)
|
||||||
{
|
{
|
||||||
const T align_size=alignment-1;
|
const T align_size=alignment-1;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user