MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / wrapDiffF

Function wrapDiffF

source/core/StarMathCommon.hpp:237–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235// Sampe as wrapDiff but for float like values
236template <typename Type>
237Type wrapDiffF(Type a, Type b, Type size) {
238 a = pfmod(a, size);
239 b = pfmod(b, size);
240
241 Type diff = a - b;
242 if (diff > size / 2)
243 diff -= size;
244 else if (diff < -size / 2)
245 diff += size;
246
247 return diff;
248}
249
250// like std::pow, except ignores sign, and the return value will match the sign
251// of the value passed in. ppow(-2, 2) == -4

Callers

nothing calls this directly

Calls 1

pfmodFunction · 0.85

Tested by

no test coverage detected