Skip to content

Commit bc95d1e

Browse files
committed
Merge master into rust-rewrite (resolve CI workflow conflicts)
2 parents e388b8d + 4c72d30 commit bc95d1e

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

hexhamming/_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
const char _version[] = "2.2.3";
1+
const char _version[] = "2.3.0";

hexhamming/python_hexhamming.cc

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,15 +272,24 @@ static PyObject * check_bytes_arrays_within_dist_wrapper(PyObject *self, PyObjec
272272
return NULL;
273273
}
274274

275+
int64_t return_value = -1;
276+
277+
Py_BEGIN_ALLOW_THREADS
278+
275279
int res;
276280
uint64_t number_of_elements = big_array_size / small_array_size;
277281
uint8_t* pBig = big_array;
278282
for (uint64_t i = 0; i < number_of_elements; i++, pBig += small_array_size) {
279283
res = (int)ptr__hamming_distance_bytes(pBig, small_array, small_array_size, max_dist);
280-
if (res == 1)
281-
return Py_BuildValue("i", i);
284+
if (res == 1) {
285+
return_value = i;
286+
break;
282287
}
283-
return Py_BuildValue("i", -1);
288+
}
289+
290+
Py_END_ALLOW_THREADS
291+
292+
return Py_BuildValue("L", return_value);
284293
}
285294

286295
/**

0 commit comments

Comments
 (0)