8000
Skip to content

Fix MSVC ARM64 build, restrict _sub_overflow_i32 to x86/x64 - #4877

Merged
eustas merged 2 commits into
libjxl:mainfrom
Snesnopic:main
Jun 30, 2026
Merged

Fix MSVC ARM64 build, restrict _sub_overflow_i32 to x86/x64#4877
eustas merged 2 commits into
libjxl:mainfrom
Snesnopic:main

Conversation

@Snesnopic
Copy link
Copy Markdown
Contributor

Description

The MSVC intrinsic _sub_overflow_i32 is not available on ARM64, causing build failures when compiling with MSVC for Windows ARM64 targets.
This PR restricts its usage to x86/x64 architectures (_M_AMD64 and _M_IX86), allowing ARM64 to fallback to the generic C implementation provided in the else branch.
The change restores compilation on Windows ARM64 without affecting other platforms.

Pull Request Checklist

  • CLA Signed: Have you signed the Contributor License Agreement (individual or corporate, as appropriate)? Only contributions from signed contributors can be accepted.
  • Authors: Have you considered adding your name to the AUTHORS file?
  • Code Style: Have you ensured your code adheres to the project's coding style guidelines? You can use ./ci.sh lint for automatic code formatting.

@eustas
eustas commented Jun 30, 2026
Copy link
Copy Markdown
Member

Ironically, clang/gcc are generating even shorter code on those platforms...

@eustas
eustas enabled auto-merge June 30, 2026 10:06
@eustas
eustas added this pull request to the merge queue Jun 30, 2026
Merged via the queue into libjxl:main with commit 2787fe3 Jun 30, 2026
89 of 98 checks passed
Alb3e3 added a commit to Alb3e3/libjxl that referenced this pull request Aug 24, 2026
The residual subtraction in enc_encoding.cc no longer needs an overflow
check, so SubOverflow has no callers left. Removing it also drops the
MSVC-only <intrin.h> include it required, along with the _M_AMD64 /
_M_IX86 guard added in libjxl#4877 for the MSVC ARM64 build.
Alb3e3 added a commit to Alb3e3/libjxl that referenced this pull request Aug 24, 2026
The residual subtraction in enc_encoding.cc no longer needs an overflow
check, so SubOverflow has no callers left. Removing it also drops the
MSVC-only <intrin.h> include it required, along with the _M_AMD64 /
_M_IX86 guard added in libjxl#4877 for the MSVC ARM64 build.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0