“Too Much Discussion Of The XOR Swap Trick”, Chris Jefferson (https://heather.cafe/posts/too_much_xor_swap_trick/).
Via HN: https://news.ycombinator.com/item?id=47750486
On Lobsters: https://lobste.rs/s/2byom8/too_much_discussion_xor_swap_trick
#XOR #Bits #Programming #Optimization #Swapping #BitFiddling #Compilers #Tricks #XorSwap
This little #bluepill runs #Ada for month without error.
https://twitter.com/DrJohnZoidberg/status/1363254069347848195
This is not to say you can’t do this with other programming languages but it plays to Adas strength of safety, #readability to spot logic errors and the in my eyes unparalleled high-level language support for low-level #bitfiddling for #embedded programming. 😀
You describe what you need with data structures and the compiler sees that the bits end up in the right places.