Skip to content

Commit c448b23

Browse files
authored
Merge pull request #5 from jepler/split-workflow-arch
fix big-endian build for completeness sake
2 parents bd5ec9f + 3c2dbe7 commit c448b23

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

.github/workflows/wheels.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,24 @@ jobs:
3131

3232

3333
build_wheels:
34-
name: Wheels on ${{ matrix.os }}
34+
name: Wheels on ${{ matrix.os }}${{ matrix.extra }}
3535
runs-on: ${{ matrix.os }}
3636
strategy:
3737
fail-fast: false
3838
matrix:
3939
os: [ubuntu-latest, windows-latest, macos-latest]
40-
40+
arch_linux: ["auto"]
41+
extra: [""]
42+
include:
43+
- os: ubuntu-latest
44+
arch_linux: "aarch64"
45+
extra: "- aarch64"
46+
- os: ubuntu-latest
47+
arch_linux: "ppc64le"
48+
extra: "- ppc64le"
49+
- os: ubuntu-latest
50+
arch_linux: "s390x"
51+
extra: "- s390x"
4152
steps:
4253
- uses: actions/checkout@v3
4354

@@ -50,7 +61,7 @@ jobs:
5061
- uses: pypa/[email protected]
5162
env:
5263
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
53-
CIBW_ARCHS_LINUX: "auto aarch64 ppc64le"
64+
CIBW_ARCHS_LINUX: ${{ matrix.arch_linux }}
5465
CIBW_PRERELEASE_PYTHONS: true
5566

5667
- name: Verify clean directory

src/main.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <pybind11/pybind11.h>
2+
#include <algorithm>
23

34
extern "C" {
45
#include "au/au_header.c"
@@ -18,6 +19,14 @@ extern "C" {
1819
#define STRINGIFY(x) #x
1920
#define MACRO_STRINGIFY(x) STRINGIFY(x)
2021

22+
#if defined(__linux__)
23+
#include <endian.h>
24+
#else
25+
// all others assumed to be little-endian
26+
#define htole16(x) (x)
27+
#define le16toh(x) (x)
28+
#endif
29+
2130
namespace py = pybind11;
2231

2332
#define MAX_SAMPLE_RATE 32000
@@ -38,6 +47,9 @@ py::bytes encode(py::bytes bytes_in, size_t input_frame_size=320, size_t output_
3847
size_t e = std::min(std::size(data_in), i + 2*input_frame_size);
3948
std::fill(std::copy(reinterpret_cast<Word16*>(&data_in[i]), reinterpret_cast<Word16*>(&data_in[e]), input), std::end(input), 0);
4049

50+
for(size_t i=0; i < MAX_FRAMESIZE; i++)
51+
input[i] = le16toh(input[i]);
52+
4153
auto mag_shift = samples_to_rmlt_coefs(input, history, mlt_coefs, input_frame_size);
4254

4355
/* Encode the mlt coefs */
@@ -47,6 +59,9 @@ py::bytes encode(py::bytes bytes_in, size_t input_frame_size=320, size_t output_
4759
mag_shift,
4860
out_words);
4961

62+
for(size_t i=0; i < MAX_BITS_PER_FRAME / 16; i++)
63+
out_words[i] = htole16(out_words[i]);
64+
5065
result.append(reinterpret_cast<char*>(&out_words[0]), output_frame_size);
5166
}
5267

0 commit comments

Comments
 (0)