@@ -1022,14 +1022,17 @@ PyObject *swig_ptr (PyObject *a)
1022
1022
return SWIG_NewPointerObj(data, SWIGTYPE_p_bool, 0);
1023
1023
}
1024
1024
if(PyArray_TYPE(ao) == NPY_UINT64) {
1025
- #if (__SIZEOF_LONG__ == 8)
1025
+ // Convert npy64 either long or long long and it depends on how compiler define int64_t.
1026
+ // In the 64bit machine, typically the int64_t should be long but it is not hold for Apple osx.
1027
+ // In this case, we want to convert npy64 to long_Long in osx
1028
+ #if __SIZEOF_LONG__ == 8 && !defined(__APPLE__)
1026
1029
return SWIG_NewPointerObj(data, SWIGTYPE_p_unsigned_long, 0);
1027
1030
#else
1028
1031
return SWIG_NewPointerObj(data, SWIGTYPE_p_unsigned_long_long, 0);
1029
1032
#endif
1030
1033
}
1031
1034
if(PyArray_TYPE(ao) == NPY_INT64) {
1032
- #if ( __SIZEOF_LONG__ == 8)
1035
+ #if __SIZEOF_LONG__ == 8 && !defined(__APPLE__ )
1033
1036
return SWIG_NewPointerObj(data, SWIGTYPE_p_long, 0);
1034
1037
#else
1035
1038
return SWIG_NewPointerObj(data, SWIGTYPE_p_long_long, 0);
@@ -1054,11 +1057,8 @@ struct PythonInterruptCallback: faiss::InterruptCallback {
1054
1057
}
1055
1058
1056
1059
};
1057
-
1058
-
1059
1060
%}
1060
1061
1061
-
1062
1062
%init %{
1063
1063
/* needed, else crash at runtime */
1064
1064
import_array();
@@ -1121,15 +1121,8 @@ int * cast_integer_to_int_ptr (int64_t x) {
1121
1121
void * cast_integer_to_void_ptr (int64_t x) {
1122
1122
return (void*)x;
1123
1123
}
1124
-
1125
1124
%}
1126
1125
1127
-
1128
-
1129
-
1130
-
1131
-
1132
-
1133
1126
%inline %{
1134
1127
void wait() {
1135
1128
// in gdb, use return to get out of this function
0 commit comments