Skip to content

fix: Unstable library feature .is_multiple_of - #243

Open
shrehanrajsingh wants to merge 1 commit into
anthropics:mainfrom
shrehanrajsingh:fix/unstable-library-features
Open

fix: Unstable library feature .is_multiple_of#243
shrehanrajsingh wants to merge 1 commit into
anthropics:mainfrom
shrehanrajsingh:fix/unstable-library-features

Conversation

@shrehanrajsingh

Copy link
Copy Markdown

use of .is_multiple_of, which is an unstable library feature Implemented custom is_multiple_of with bound check Also added a dockerfile and ccc-docker.sh that runs a C file in a container since I couldn't find a way to run this compiler on MacOS.

This pull request introduces a new utility function for checking multiples, refactors codebase-wide usages of this logic to use the new utility, and adds Docker-based tooling for building and running the compiler in a consistent environment. The most important changes are grouped below by theme.

New Utility Function and Refactoring:

  • Added a generic is_multiple_of function in src/common/is_multiple_of.rs and exposed it via src/common/mod.rs for use throughout the codebase. [1] [2]
  • Replaced direct calls to .is_multiple_of() and manual modulus checks with the new crate::common::is_multiple_of::is_multiple_of function in ARM, x86, and RISC-V backend files, improving code consistency and portability. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]

Build and Tooling Improvements:

  • Added a Dockerfile to build the compiler and its dependencies in a reproducible environment, supporting cross-compilation for multiple architectures.
  • Introduced ccc-docker.sh, a script for compiling and running C files using the compiler inside Docker, simplifying usage and ensuring consistent builds across systems.

Minor Logic Adjustments:

  • Replaced .is_multiple_of with custom is_multiple_of routine because Rust refused to compile code containing .is_multiple_of labelling it "Unstable library feature"

These changes collectively improve code maintainability, portability, and developer experience.

use of .is_multiple_of, which is an unstable library feature
Implemented custom is_multiple_of with bound check
Also added a dockerfile and ccc-docker.sh that runs a C file in a
container since I couldn't find a way to run this compiler on MacOS
@shrehanrajsingh shrehanrajsingh changed the title FIX: Unstable library feature .is_multiple_of fix: Unstable library feature .is_multiple_of Feb 18, 2026
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.

1 participant