From d83ae009829b59cf6ccd38345ec872de1b03d993 Mon Sep 17 00:00:00 2001 From: Elias Batek Date: Sun, 6 Oct 2024 00:00:42 +0200 Subject: [PATCH] Make the pure round()ing function private --- pixmappaint.d | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pixmappaint.d b/pixmappaint.d index 4d55d6c..3750ff1 100644 --- a/pixmappaint.d +++ b/pixmappaint.d @@ -20,13 +20,16 @@ module arsd.pixmappaint; import arsd.color; import arsd.core; -private float hackyRound(float f) { +private float roundImpl(float f) { import std.math : round; + return round(f); } -float round(float f) pure @nogc nothrow @trusted { - return (cast(float function(float) pure @nogc nothrow) &hackyRound)(f); +// `pure` rounding function. +// std.math.round() isn’t pure on all targets. +private float round(float f) pure @nogc nothrow @trusted { + return (castTo!(float function(float) pure @nogc nothrow)(&roundImpl))(f); } /*