replaced msvc __int64 to int64_t, updated Int64ToString and TryParseI…#1524
Open
smhussa22 wants to merge 1 commit intoMCLCE:mainfrom
Open
replaced msvc __int64 to int64_t, updated Int64ToString and TryParseI…#1524smhussa22 wants to merge 1 commit intoMCLCE:mainfrom
smhussa22 wants to merge 1 commit intoMCLCE:mainfrom
Conversation
…nt64 to use int64_t instead
ec51697 to
7bcfedf
Compare
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.
…nt64 to use int64_t instead
Description
Changed the use of MSVC-specific 64 bit integer type to C++ standard 64 bit integer type to increase compiler-portability, which is consistent with the rest of the codebase (see related issues).
Changes
Replaced uses of the MSVC
__int64to useint64_tfrom cstdint for portability reasons (this has been happening in other files in the repo as well).Changed MSVC-specific conversion functions (TryParseInt64, Int64ToString) to reflect this change.
Previous Behavior
The file previously used
__int64which is MSVC-specific. Thus, two functionsTryParseInt64andInt64ToStringalso used__int64parameters.Root Cause
Use of MSVC's 64 bit integer type reduces portability when the C++ standard
int64_ttype could be used to fix this.The change from MSVC
__int64toint64_tis being done in other parts of the codebase, so it is best to reflect this everywhere (see related issues).New Behavior
The affected functions behave exactly as they did before, which is expected.
Fix Implementation
Int64ToString:
_i64toa_sfunction which converts__int64to a C-style string via a buffer. The function then returned this C-style string in a std::string constructor.int64_tand returned that.TryParseInt64:
_strtoi64and replaced withstrtolllong longtoint64_t.AI Use Disclosure
This code was written by myself without the use of any LLM/AI.
Related Issues