aboutsummaryrefslogtreecommitdiff
path: root/src/util/numeric.cpp
Commit message (Expand)AuthorAge
* Keep mapblocks in memory if they're in range (#10714)hecks2021-02-26
* numeric: Fix clang, broken since d5456daSmallJoker2019-02-09
* Use true pitch/yaw/roll rotations without loss of precision by pgimeno (#8019)Paul Ouellette2019-02-07
* Fix MurmurHash implementation to really be unaligned (#7482)sfan52018-06-26
* Use server's zoom fov for distant world loading.Lars Hofhansl2018-05-15
* Zoom adjustDist(): Improve variable name (#7208)Paramat2018-04-05
* Fix last performance-type-promotion-in-math-fn problemsLoic Blot2018-04-04
* Optimize a little bit isBlockInSight, adjustDist & collisions (#7193)Loïc Blot2018-04-04
* Fix last clang-tidy reported problems for performance-type-promotion-in-math-fnLoic Blot2018-04-03
* Fix various clang-tidy reported performance-type-promotion-in-math-fnLoïc Blot2018-04-03
* Allow zoom to actually show more data.Lars Hofhansl2017-11-15
* Move files to subdirectories (#6599)Vitaliy2017-11-08
* Code modernization: subfolders (#6283)Loïc Blot2017-08-19
* Clean up numeric.h and split FacePositionCache from itShadowNinja2017-05-06
* Remove `mathconstants.h` and use the correct way to get `M_PI` in MSVC. (#5072)red-0012017-01-20
* Fix incorrect distance computation for visible blocks (#4765)Rogier-52016-11-11
* use unordered containers where possible (patch 4 on X)Loic Blot2016-10-06
* HOTFIX: fix too agressive block cullingRealBadAngel2016-02-18
* Clean up threadingShadowNinja2015-08-23
* src/util/numeric.{cpp,h}: Fix FacePositionCache data raceBřetislav Štec2015-08-02
* Clean scaling pre-filter for formspec/HUD.Aaron Suen2015-04-01
* GenElementManager: Pass opaque handles to Lua and rename to ObjDefManagerkwolekr2015-03-31
* Add support for the PCG32 PRNG algo (and associated script APIs)kwolekr2015-03-22
* Performance Improvement: Use a cache which caches result for getFacePositions.Loic Blot2015-02-16
* Fix compiling with 32bit MinGWSfan52013-11-12
* Accept hexadecimal and string values for seedskwolekr2013-11-04
* include mathconstants.h in numerics.cppVincent Heuken2013-07-07
* Fix math for isBlockInSight. Fixes #718 (client-side).Aaron Suen2013-05-18
* Migrate to STL containers/algorithms.Ilya Zhuravlev2013-03-11
* Update Copyright YearsSfan52013-02-24
* Change Minetest-c55 to MinetestPilzAdam2013-02-24
* Hopefully fix includes on mingwPerttu Ahola2012-06-17
* Initially split utility.h to multiple files in util/Perttu Ahola2012-06-17
class="hl kwa">assert(!ret || errno == EBUSY); #else assert(!ret); #endif UNUSED(ret); #endif } void Semaphore::post(unsigned int num) { assert(num > 0); #ifdef _WIN32 ReleaseSemaphore(semaphore, num, NULL); #else for (unsigned i = 0; i < num; i++) { int ret = sem_post(&semaphore); assert(!ret); UNUSED(ret); } #endif } void Semaphore::wait() { #ifdef _WIN32 WaitForSingleObject(semaphore, INFINITE); #else int ret = sem_wait(&semaphore); assert(!ret); UNUSED(ret); #endif } bool Semaphore::wait(unsigned int time_ms) { #ifdef _WIN32 unsigned int ret = WaitForSingleObject(semaphore, time_ms); if (ret == WAIT_OBJECT_0) { return true; } else { assert(ret == WAIT_TIMEOUT); return false; } #else # if defined(__MACH__) && defined(__APPLE__) mach_timespec_t wait_time; wait_time.tv_sec = time_ms / 1000; wait_time.tv_nsec = 1000000 * (time_ms % 1000); errno = 0; int ret = semaphore_timedwait(semaphore, wait_time); switch (ret) { case KERN_OPERATION_TIMED_OUT: errno = ETIMEDOUT; break; case KERN_ABORTED: errno = EINTR; break; default: if (ret) errno = EINVAL; } # else struct timespec wait_time; struct timeval now; if (gettimeofday(&now, NULL) == -1) { std::cerr << "Semaphore::wait(ms): Unable to get time with gettimeofday!" << std::endl; abort(); } wait_time.tv_nsec = ((time_ms % 1000) * 1000 * 1000) + (now.tv_usec * 1000); wait_time.tv_sec = (time_ms / 1000) + (wait_time.tv_nsec / (1000 * 1000 * 1000)) + now.tv_sec; wait_time.tv_nsec %= 1000 * 1000 * 1000; int ret = sem_timedwait(&semaphore, &wait_time); # endif assert(!ret || (errno == ETIMEDOUT || errno == EINTR)); return !ret; #endif }