From 0b0e542ce62c7bea803ccffae86de5fe94d81ae9 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Fri, 1 Sep 2023 18:42:37 -0700 Subject: [PATCH] Fixed auto-vectorization for vector_spherical_distance with MSVC --- src/vector.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vector.c b/src/vector.c index aae909a..d3ebedb 100644 --- a/src/vector.c +++ b/src/vector.c @@ -695,6 +695,8 @@ vector_spherical_distance(PG_FUNCTION_ARGS) { Vector *a = PG_GETARG_VECTOR_P(0); Vector *b = PG_GETARG_VECTOR_P(1); + float *ax = a->x; + float *bx = b->x; float dp = 0.0; double distance; @@ -702,7 +704,7 @@ vector_spherical_distance(PG_FUNCTION_ARGS) /* Auto-vectorized */ for (int i = 0; i < a->dim; i++) - dp += a->x[i] * b->x[i]; + dp += ax[i] * bx[i]; distance = (double) dp;