Make the pure round()ing function private

This commit is contained in:
Elias Batek 2024-10-06 00:00:42 +02:00
parent 011abf026e
commit d83ae00982
1 changed files with 6 additions and 3 deletions

View File

@ -20,13 +20,16 @@ module arsd.pixmappaint;
import arsd.color; import arsd.color;
import arsd.core; import arsd.core;
private float hackyRound(float f) { private float roundImpl(float f) {
import std.math : round; import std.math : round;
return round(f); return round(f);
} }
float round(float f) pure @nogc nothrow @trusted { // `pure` rounding function.
return (cast(float function(float) pure @nogc nothrow) &hackyRound)(f); // std.math.round() isnt pure on all targets.
private float round(float f) pure @nogc nothrow @trusted {
return (castTo!(float function(float) pure @nogc nothrow)(&roundImpl))(f);
} }
/* /*