]> git.ozlabs.org Git - ccan/blobdiff - ccan/strgrp/strgrp.c
strgrp: Fix indexing of per-thread storage for cosine filter
[ccan] / ccan / strgrp / strgrp.c
index ba87063206c9d76d7f51eb106111b101f3c19a2c..52d6957b30d04046b1298d135214faaf8fe1882d 100644 (file)
@@ -283,12 +283,12 @@ cache(struct strgrp *const ctx, struct strgrp_grp *const grp,
 
 static inline struct cosvec *
 tl_avec(struct strgrp *ctx) {
-    return &ctx->cosvecs[omp_get_thread_num()];
+    return &ctx->cosvecs[2 * omp_get_thread_num()];
 }
 
 static inline struct cosvec *
 tl_bvec(struct strgrp *ctx) {
-    return &ctx->cosvecs[omp_get_thread_num() + 1];
+    return &ctx->cosvecs[2 * omp_get_thread_num() + 1];
 }
 
 static struct strgrp_grp *