From a9b6b2cf2a75aa6be839782ab8692e26ae43e7ef Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Sat, 28 Nov 2026 16:44:06 -0800 Subject: [PATCH] Fixed compilation when half is uint16 --- src/ivfutils.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ivfutils.c b/src/ivfutils.c index 81bf5d1d..6909ad63 100644 --- a/src/ivfutils.c +++ b/src/ivfutils.c @@ -349,12 +349,14 @@ HalfvecUpdateCenter(Pointer v, int dimensions, float *x) for (int i = 0; i < dimensions; i++) { - half value = Float4ToHalfUnchecked(x[i]); + float value = x[i]; - if (HalfIsInf(value)) - value = x[i] > 0 ? HALF_MAX : -HALF_MAX; + if (value > HALF_MAX) + value = HALF_MAX; + else if (value < -HALF_MAX) + value = -HALF_MAX; - vec->x[i] = value; + vec->x[i] = Float4ToHalfUnchecked(value); } }