fix: Unstable library feature .is_multiple_of - #243
Open
shrehanrajsingh wants to merge 1 commit into
Open
Conversation
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 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.
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:
is_multiple_offunction insrc/common/is_multiple_of.rsand exposed it viasrc/common/mod.rsfor use throughout the codebase. [1] [2].is_multiple_of()and manual modulus checks with the newcrate::common::is_multiple_of::is_multiple_offunction 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:
Dockerfileto build the compiler and its dependencies in a reproducible environment, supporting cross-compilation for multiple architectures.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:
These changes collectively improve code maintainability, portability, and developer experience.