Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
build-and-test:
name: Testing with Python 3.${{ matrix.python_minor }} on Linux
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
python_minor: [ "6" , "7" , "8" , "9" , "10" ]
Expand All @@ -38,7 +38,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags')
needs: build-and-test
name: Source distribution
runs-on: macos-11
runs-on: macos-13

steps:
- uses: actions/checkout@v4.2.2
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags')
needs: [build-and-test, sdist]
name: Build macOS ${{ matrix.cibw_python }} ${{ matrix.cibw_arch }} wheels
runs-on: macos-11
runs-on: macos-13
strategy:
fail-fast: true
matrix:
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags')
needs: [build-and-test, sdist]
name: Build ${{ matrix.cibw_buildlinux }} ${{ matrix.cibw_arch }} wheels
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags')
needs: [build-and-test, sdist]
name: Build Windows wheels
runs-on: windows-2019
runs-on: windows-2022

steps:
- uses: actions/checkout@v4.2.2
Expand Down Expand Up @@ -192,7 +192,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags')
needs: [wheels_macos, wheels_linux, wheels_windows]
name: Publish wheels
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- name: Collect sdist and wheels
Expand Down
2 changes: 1 addition & 1 deletion hexhamming/_version.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
const char _version[] = "2.2.3";
const char _version[] = "2.3.0";
15 changes: 12 additions & 3 deletions hexhamming/python_hexhamming.cc
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,24 @@ static PyObject * check_bytes_arrays_within_dist_wrapper(PyObject *self, PyObjec
return NULL;
}

int64_t return_value = -1;

Py_BEGIN_ALLOW_THREADS

int res;
uint64_t number_of_elements = big_array_size / small_array_size;
uint8_t* pBig = big_array;
for (uint64_t i = 0; i < number_of_elements; i++, pBig += small_array_size) {
res = (int)ptr__hamming_distance_bytes(pBig, small_array, small_array_size, max_dist);
if (res == 1)
return Py_BuildValue("i", i);
if (res == 1) {
return_value = i;
break;
}
return Py_BuildValue("i", -1);
}

Py_END_ALLOW_THREADS

return Py_BuildValue("L", return_value);
}

/**
Expand Down
Loading