MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / fastfloor

Method fastfloor

Source/Utils/SimplexIslands.hpp:66–69  ·  view source on GitHub ↗

This method is a *lot* faster than using (int)Math.floor(x)

Source from the content-addressed store, hash-verified

64
65 // This method is a *lot* faster than using (int)Math.floor(x)
66 static inline int32_t fastfloor(double fp) {
67 int32_t i = static_cast<int32_t>(fp);
68 return (fp < i) ? (i - 1) : (i);
69 }
70
71 double dot(Grad g, double x, double y) {
72 return g.x*x + g.y*y;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected