diff --git a/core/math/fixed/fixed.odin b/core/math/fixed/fixed.odin index 28f87b6d2..233eefd6b 100644 --- a/core/math/fixed/fixed.odin +++ b/core/math/fixed/fixed.odin @@ -29,7 +29,7 @@ Fixed32_32 :: distinct Fixed(i64, 32) Fixed52_12 :: distinct Fixed(i64, 12) -init_from_f64 :: proc(x: ^$T/Fixed($Backing, $Fraction_Width), val: f64) { +init_from_f64 :: proc "contextless" (x: ^$T/Fixed($Backing, $Fraction_Width), val: f64) { i, f := math.modf(math.abs(val)) x.i = Backing(f * (1< f64 { +to_f64 :: proc "contextless" (x: $T/Fixed($Backing, $Fraction_Width)) -> f64 { sign := -1.0 if x.i < 0 else 1.0 num := math.abs(x.i) res := f64(num >> Fraction_Width) @@ -55,39 +55,39 @@ to_f64 :: proc(x: $T/Fixed($Backing, $Fraction_Width)) -> f64 { @(require_results) -add :: proc(x, y: $T/Fixed) -> T { +add :: proc "contextless" (x, y: $T/Fixed) -> T { return {x.i + y.i} } @(require_results) -sub :: proc(x, y: $T/Fixed) -> T { +sub :: proc "contextless" (x, y: $T/Fixed) -> T { return {x.i - y.i} } @(require_results) -mul :: proc(x, y: $T/Fixed($Backing, $Fraction_Width)) -> (z: T) { +mul :: proc "contextless" (x, y: $T/Fixed($Backing, $Fraction_Width)) -> (z: T) { z.i = intrinsics.fixed_point_mul(x.i, y.i, Fraction_Width) return } @(require_results) -mul_sat :: proc(x, y: $T/Fixed($Backing, $Fraction_Width)) -> (z: T) { +mul_sat :: proc "contextless" (x, y: $T/Fixed($Backing, $Fraction_Width)) -> (z: T) { z.i = intrinsics.fixed_point_mul_sat(x.i, y.i, Fraction_Width) return } @(require_results) -div :: proc(x, y: $T/Fixed($Backing, $Fraction_Width)) -> (z: T) { +div :: proc "contextless" (x, y: $T/Fixed($Backing, $Fraction_Width)) -> (z: T) { z.i = intrinsics.fixed_point_div(x.i, y.i, Fraction_Width) return } @(require_results) -div_sat :: proc(x, y: $T/Fixed($Backing, $Fraction_Width)) -> (z: T) { +div_sat :: proc "contextless" (x, y: $T/Fixed($Backing, $Fraction_Width)) -> (z: T) { z.i = intrinsics.fixed_point_div_sat(x.i, y.i, Fraction_Width) return } @(require_results) -floor :: proc(x: $T/Fixed($Backing, $Fraction_Width)) -> Backing { +floor :: proc "contextless" (x: $T/Fixed($Backing, $Fraction_Width)) -> Backing { if x.i >= 0 { return x.i >> Fraction_Width } else { @@ -95,11 +95,11 @@ floor :: proc(x: $T/Fixed($Backing, $Fraction_Width)) -> Backing { } } @(require_results) -ceil :: proc(x: $T/Fixed($Backing, $Fraction_Width)) -> Backing { +ceil :: proc "contextless" (x: $T/Fixed($Backing, $Fraction_Width)) -> Backing { return (x.i + (1 << Fraction_Width - 1)) >> Fraction_Width } @(require_results) -round :: proc(x: $T/Fixed($Backing, $Fraction_Width)) -> Backing { +round :: proc "contextless" (x: $T/Fixed($Backing, $Fraction_Width)) -> Backing { return (x.i + (1 << (Fraction_Width - 1))) >> Fraction_Width }