-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Arithmetic logic support #49292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is not self-explanatory at all, we're not mind readers. And TypeScript officially has no spec, so there's nothing to update. A wild guess is be that you want #26382. |
It is unrelated. |
Unfortunately you still didn't fill out the issue template after updating. :-( From that brief example it now looks like a duplicate of #27501. This is intentionally not supported: #27501 (comment) It works fine if you add an explicit type conversion using |
Yes, casting is competitive, not quite the same tho. We may not argue about the clarity of code which uses logic arithmetic :). |
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Suggestion
Should be self-explanatory. But:
In short:
aNumber += (a<b) * 12 - (a>=b) * 14
Is significantly faster than:
if (a<b) { aNumber += 12} else {aNumber -= 14}
The first method ends up in error yet most major languages and runtimes handle it correctly.
🔍 Search Terms
arithmetic logic
ALU
arithmetic logic unit
performance
The text was updated successfully, but these errors were encountered: