Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
vaylian
6 months ago
|
parent
|
context
|
favorite
| on:
That XOR Trick (2020)
It would set a[i] to zero instead of swapping two values, right?
praptak
6 months 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!
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: