libclc: Simplify fract implementation (#189080)

This commit is contained in:
Matt Arsenault 2026-03-28 00:16:07 +01:00 committed by GitHub
parent ae63230c23
commit 15bc5b0267
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,9 +17,9 @@
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_fract(__CLC_GENTYPE x,
private __CLC_GENTYPE *iptr) {
*iptr = __clc_floor(x);
__CLC_GENTYPE r = __clc_fmin(x - *iptr, MIN_CONSTANT);
__CLC_GENTYPE sub = x - *iptr;
__CLC_GENTYPE r = sub >= MIN_CONSTANT ? MIN_CONSTANT : sub;
r = __clc_isinf(x) ? __CLC_FP_LIT(0.0) : r;
r = __clc_isnan(x) ? x : r;
return r;
}