/* * mathutil.h * BoE * * Created by Celtic Minstrel on 16/04/09. * */ #include #include using std::abs; short get_ran (short times,short min,short max); short s_pow(short x,short y); short s_sqrt(short val); short max(short a,short b); short min(short a,short b); short minmax(short min,short max,short k); short gcd(short a, short b); sf::Time time_in_ticks(int ticks); template inline void move_to_zero(T& val){ if (val < 0) val++; if (val > 0) val--; } // Not quite mathutil... perhaps I need a more general util file. // This is from . template void erase_if(ContainerT& items, const PredicateT& predicate) { for(auto it = items.begin(); it != items.end();) { if(predicate(*it)) it = items.erase(it); else ++it; } };