Skip to content

Commit 1431632

Browse files
authored
Merge pull request #383 from MasterAler/develop
Fix global linkages
2 parents fb1885b + fb3a699 commit 1431632

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

hnswlib/hnswlib.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@
1616
#include <intrin.h>
1717
#include <stdexcept>
1818
#include "cpu_x86.h"
19-
void cpu_x86::cpuid(int32_t out[4], int32_t eax, int32_t ecx) {
19+
static void cpu_x86::cpuid(int32_t out[4], int32_t eax, int32_t ecx) {
2020
__cpuidex(out, eax, ecx);
2121
}
22-
__int64 xgetbv(unsigned int x) {
22+
static __int64 xgetbv(unsigned int x) {
2323
return _xgetbv(x);
2424
}
2525
#else
2626
#include <x86intrin.h>
2727
#include <cpuid.h>
2828
#include <stdint.h>
29-
void cpuid(int32_t cpuInfo[4], int32_t eax, int32_t ecx) {
29+
static void cpuid(int32_t cpuInfo[4], int32_t eax, int32_t ecx) {
3030
__cpuid_count(eax, ecx, cpuInfo[0], cpuInfo[1], cpuInfo[2], cpuInfo[3]);
3131
}
32-
uint64_t xgetbv(unsigned int index) {
32+
static uint64_t xgetbv(unsigned int index) {
3333
uint32_t eax, edx;
3434
__asm__ __volatile__("xgetbv" : "=a"(eax), "=d"(edx) : "c"(index));
3535
return ((uint64_t)edx << 32) | eax;
@@ -51,7 +51,7 @@ uint64_t xgetbv(unsigned int index) {
5151
// Adapted from https://github.com/Mysticial/FeatureDetector
5252
#define _XCR_XFEATURE_ENABLED_MASK 0
5353

54-
bool AVXCapable() {
54+
static bool AVXCapable() {
5555
int cpuInfo[4];
5656

5757
// CPU support
@@ -78,7 +78,7 @@ bool AVXCapable() {
7878
return HW_AVX && avxSupported;
7979
}
8080

81-
bool AVX512Capable() {
81+
static bool AVX512Capable() {
8282
if (!AVXCapable()) return false;
8383

8484
int cpuInfo[4];

hnswlib/space_ip.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,10 @@ namespace hnswlib {
281281
#endif
282282

283283
#if defined(USE_SSE) || defined(USE_AVX) || defined(USE_AVX512)
284-
DISTFUNC<float> InnerProductSIMD16Ext = InnerProductSIMD16ExtSSE;
285-
DISTFUNC<float> InnerProductSIMD4Ext = InnerProductSIMD4ExtSSE;
286-
DISTFUNC<float> InnerProductDistanceSIMD16Ext = InnerProductDistanceSIMD16ExtSSE;
287-
DISTFUNC<float> InnerProductDistanceSIMD4Ext = InnerProductDistanceSIMD4ExtSSE;
284+
static DISTFUNC<float> InnerProductSIMD16Ext = InnerProductSIMD16ExtSSE;
285+
static DISTFUNC<float> InnerProductSIMD4Ext = InnerProductSIMD4ExtSSE;
286+
static DISTFUNC<float> InnerProductDistanceSIMD16Ext = InnerProductDistanceSIMD16ExtSSE;
287+
static DISTFUNC<float> InnerProductDistanceSIMD4Ext = InnerProductDistanceSIMD4ExtSSE;
288288

289289
static float
290290
InnerProductDistanceSIMD16ExtResiduals(const void *pVect1v, const void *pVect2v, const void *qty_ptr) {

hnswlib/space_l2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ namespace hnswlib {
144144
#endif
145145

146146
#if defined(USE_SSE) || defined(USE_AVX) || defined(USE_AVX512)
147-
DISTFUNC<float> L2SqrSIMD16Ext = L2SqrSIMD16ExtSSE;
147+
static DISTFUNC<float> L2SqrSIMD16Ext = L2SqrSIMD16ExtSSE;
148148

149149
static float
150150
L2SqrSIMD16ExtResiduals(const void *pVect1v, const void *pVect2v, const void *qty_ptr) {

0 commit comments

Comments
 (0)