From 6b80f8a9dbef56f5af837f329132168634103d04 Mon Sep 17 00:00:00 2001 From: Reuben Dunnington Date: Sat, 14 Sep 2024 17:43:44 -0700 Subject: [PATCH] support 32bit architectures * fix compile error for 32bit arches * ci: build and test 32bit executables --- .github/workflows/ci.yml | 35 ++++++++++++++++++++++++++++------- stable_array.zig | 6 +++++- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 52f8a02..9f8202f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,14 +7,35 @@ on: pull_request: jobs: - test: - strategy: - matrix: - os: [windows-latest, macos-latest, ubuntu-latest] - runs-on: ${{matrix.os}} + test-windows: + runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: mlugg/setup-zig@v1 with: version: 0.14.0 - - run: zig build test + - run: | + zig build test + zig build -Dtarget=x86-windows-gnu test + + test-macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + - uses: mlugg/setup-zig@v1 + with: + version: 0.14.0 + # Note that there's no testing for 32-bit on macos since offical support has been dropped + - run: | + zig build test + + test-linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: mlugg/setup-zig@v1 + with: + version: 0.14.0 + - run: | + zig build test + zig build -Dtarget=x86-linux-gnu test diff --git a/stable_array.zig b/stable_array.zig index ee6f744..d9c101e 100644 --- a/stable_array.zig +++ b/stable_array.zig @@ -469,7 +469,11 @@ test "huge max size" { const MB = KB * 1024; const GB = MB * 1024; - var a = StableArray(u8).init(GB * 128); + const MAX_MEMORY_32 = GB * 1; + const MAX_MEMORY_64 = GB * 128; + const MAX_MEMORY = if (@sizeOf(usize) < @sizeOf(u64)) MAX_MEMORY_32 else MAX_MEMORY_64; + + var a = StableArray(u8).init(MAX_MEMORY); defer a.deinit(); try a.resize(MB * 4);