Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
vaylian
4 days ago
|
parent
|
context
|
favorite
| on:
That XOR Trick (2020)
It would set a[i] to zero instead of swapping two values, right?
praptak
4 days ago
[–]
Yes. Now we only need a legit use case for code that swaps values only if they are in different locations, otherwise zeroes the aliased location. Then we can finally do it using the xor swap!
reply
Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: