optimize swap
This commit is contained in:
parent
751e6d9cb4
commit
6ff4147448
@ -19,7 +19,10 @@
|
||||
* @param yp Segundo valor
|
||||
*/
|
||||
void swap(int *xp, int *yp) {
|
||||
int temp = *xp;
|
||||
*xp = *yp;
|
||||
*yp = temp;
|
||||
if (xp == yp) {
|
||||
return;
|
||||
}
|
||||
*xp = *xp + *yp;
|
||||
*yp = *xp - *yp;
|
||||
*xp = *xp - *yp;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user