/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/ThirdParty/Kraut/KrautFoundation/Math/Source/Math.cpp
62 строки
1010 B
Jan Krassnigg
Replaced precompiled Kraut libs with sources (#678)
03 сен 2022, 22:17
Не верифицирован
03 сен 2022, 22:17
b339d34
Код
Авторство
О чём код?
#include "../Math.h" namespace AE_NS_FOUNDATION { float aeMath::Round (float f) { return aeMath::Floor (f + 0.5f); } float aeMath::Round (float f, float fRoundTo) { return Round (f / fRoundTo) * fRoundTo; } bool aeMath::IsPowerOf (aeInt32 value, aeInt32 base) { if (value == 1) return true; while (value > base) { if (value % base == 0) value /= base; else return false; } return (value == base); } aeInt32 aeMath::PowerOfTwo_Floor (aeUInt32 npot) { if (IsPowerOf2 (npot)) return (npot); for (aeInt32 i = 1; i <= (sizeof (npot) * 8); ++i) { npot >>= 1; if (npot == 1) return (npot << i); } return (1); } aeInt32 aeMath::PowerOfTwo_Ceil (aeUInt32 npot) { if (IsPowerOf2 (npot)) return (npot); for (int i=1; i <= (sizeof (npot) * 8); ++i) { npot >>= 1; if (npot == 1) return (npot << (i + 1)); } return (1); } }