repositories
/
TD_C.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
49a168a
)
TP 7 exo1: Remove a useless branching in a int* swap function
author
Jérôme Benoit
<jerome.benoit@piment-noir.org>
Fri, 10 Mar 2017 08:29:28 +0000
(09:29 +0100)
committer
Jérôme Benoit
<jerome.benoit@piment-noir.org>
Fri, 10 Mar 2017 08:29:28 +0000
(09:29 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
TP_7/exo1/exo1.c
patch
|
blob
|
blame
|
history
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) {