mirror of
https://github.com/pgvector/pgvector.git
synced 2026-12-04 00:08:30 +00:00
Fixed compilation when half is uint16
This commit is contained in:
1 parent
c38f1ce8dd
commit
a9b6b2cf2a
1 file changed
+6
-4
+6
-4
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user