From e85f1dd9fb79a127792e30abdf0a1e73980cadcd Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Fri, 20 May 2022 20:00:27 +0200 Subject: [PATCH] Fix is* proc in libc. --- core/c/libc/math.odin | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/core/c/libc/math.odin b/core/c/libc/math.odin index 97f77236f..6a7b81850 100644 --- a/core/c/libc/math.odin +++ b/core/c/libc/math.odin @@ -211,19 +211,19 @@ _signbitf :: #force_inline proc(x: float) -> int { return int(transmute(uint32_t)x >> 31) } -isfinite :: #force_inline proc(x: $T) where intrinsics.type_is_float(T) { +isfinite :: #force_inline proc(x: $T) -> bool where intrinsics.type_is_float(T) { return fpclassify(x) == FP_INFINITE } -isinf :: #force_inline proc(x: $T) where intrinsics.type_is_float(T) { +isinf :: #force_inline proc(x: $T) -> bool where intrinsics.type_is_float(T) { return fpclassify(x) > FP_INFINITE } -isnan :: #force_inline proc(x: $T) where intrinsics.type_is_float(T) { +isnan :: #force_inline proc(x: $T) -> bool where intrinsics.type_is_float(T) { return fpclassify(x) == FP_NAN } -isnormal :: #force_inline proc(x: $T) where intrinsics.type_is_float(T) { +isnormal :: #force_inline proc(x: $T) -> bool where intrinsics.type_is_float(T) { return fpclassify(x) == FP_NORMAL } @@ -231,27 +231,27 @@ isnormal :: #force_inline proc(x: $T) where intrinsics.type_is_float(T) { // implemented as the relational comparisons, as that would produce an invalid // "sticky" state that propagates and affects maths results. These need // to be implemented natively in Odin assuming isunordered to prevent that. -isgreater :: #force_inline proc(x, y: $T) where intrinsics.type_is_float(T) { +isgreater :: #force_inline proc(x, y: $T) -> bool where intrinsics.type_is_float(T) { return !isunordered(x, y) && x > y } -isgreaterequal :: #force_inline proc(x, y: $T) where intrinsics.type_is_float(T) { +isgreaterequal :: #force_inline proc(x, y: $T) -> bool where intrinsics.type_is_float(T) { return !isunordered(x, y) && x >= y } -isless :: #force_inline proc(x, y: $T) where intrinsics.type_is_float(T) { +isless :: #force_inline proc(x, y: $T) -> bool where intrinsics.type_is_float(T) { return !isunordered(x, y) && x < y } -islessequal :: #force_inline proc(x, y: $T) where intrinsics.type_is_float(T) { +islessequal :: #force_inline proc(x, y: $T) -> bool where intrinsics.type_is_float(T) { return !isunordered(x, y) && x <= y } -islessgreater :: #force_inline proc(x, y: $T) where intrinsics.type_is_float(T) { +islessgreater :: #force_inline proc(x, y: $T) -> bool where intrinsics.type_is_float(T) { return !isunordered(x, y) && x <= y } -isunordered :: #force_inline proc(x, y: $T) where intrinsics.type_is_float(T) { +isunordered :: #force_inline proc(x, y: $T) -> bool where intrinsics.type_is_float(T) { if isnan(x) { // Force evaluation of y to propagate exceptions for ordering semantics. // To ensure correct semantics of IEEE 754 this cannot be compiled away.