Fix MSVC ARM64 build, restrict _sub_overflow_i32 to x86/x64 - #4877
Merged
Conversation
Member
|
Ironically, clang/gcc are generating even shorter code on those platforms... |
eustas
approved these changes
Jun 30, 2026
eustas
enabled auto-merge
June 30, 2026 10:06
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The MSVC intrinsic
_sub_overflow_i32is 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_AMD64and_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
./ci.sh lintfor automatic code formatting.