Skip to content

optimized constant in dto(u)ll#726

Open
ZERICO2005 wants to merge 1 commit intomasterfrom
opt_dtoll
Open

optimized constant in dto(u)ll#726
ZERICO2005 wants to merge 1 commit intomasterfrom
opt_dtoll

Conversation

@ZERICO2005
Copy link
Contributor

@ZERICO2005 ZERICO2005 commented Mar 4, 2026

cp a, 11 could be replaced with any constant between 11 and 62, so I was able to replace it with cp a, c since C is between 16 and 31. The reason this check exists is just to ensure that the shift amount passed into __llshl is between 0 and 63. For dtoll, A >= 11 would imply that the result would not fit inside a 64 bit integer anyways (like inf/NaN), so the result is UB (undefined behavior).

@ZERICO2005 ZERICO2005 marked this pull request as draft March 4, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant