Computing Atlas

How Computing Was Built
Sign In
Text size
100%
Theme
Algorithm

XOR swap algorithm

Numerical Algorithm

The XOR swap algorithm, also called the exclusive or swap, uses the exclusive-or bitwise operation to exchange the values of two variables without using the temporary variable that a conventional swap normally requires. It relies purely on bitwise arithmetic between the two variables themselves rather than on an external storage location. This description is adapted from Wikipedia contributors under CC BY-SA 4.0; changes were made. https://creativecommons.org/licenses/by-sa/4.0/

Connections

In Field

Source Wikipedia: XOR swap algorithm
Sources
Wikipedia: XOR swap algorithm
In Field: Algorithms and Complexity Theory, Lead sentence
Quote, In Field: Algorithms and Complexity Theory, Lead sentence
exclusive or swap (sometimes shortened to XOR swap) is an algorithm that uses the exclusive or bitwise operation to swap the values of two variables without using the temporary variable which is normally required.
View the Source
Comments (0)
No comments yet. Be the first to share a thought.
Reader Challenges (0)
No disputes yet. Spotted an error or a better source? Open the first one.