repositories
/
TD_C.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
TP 7 exo1: Remove a useless branching in a int* swap function
[TD_C.git]
/
TP_7
/
exo1
/
exo1.c
diff --git
a/TP_7/exo1/exo1.c
b/TP_7/exo1/exo1.c
index c3ae354589f55c6abdf52b30554a7fb10c8dd893..6509b0635333c8196cc7540b67f888bd9ab6c8c3 100644
(file)
--- a/
TP_7/exo1/exo1.c
+++ b/
TP_7/exo1/exo1.c
@@
-17,11
+17,9
@@
void xorSwap (int *v1, int *v2) {
}
void swap(int* v1, int* v2) {
- if (v1 != v2) {
- int tmp = *v1;
- *v1 = *v2;
- *v2 = tmp;
- }
+ int tmp = *v1;
+ *v1 = *v2;
+ *v2 = tmp;
}
void displayArray(int* array, int count) {