Showing
2 changed files
with
15 additions
and
12 deletions
... | ... | @@ -46,10 +46,9 @@ TR_heapGet(TR_Heap this) |
46 | 46 | return value; |
47 | 47 | } |
48 | 48 | |
49 | - SWAP( | |
50 | - void *, | |
51 | - TR_darrGet((TR_Dynarray)this, 0), | |
52 | - TR_darrGet((TR_Dynarray)this, idx)); | |
49 | + const void * tmp = TR_darrGet((TR_Dynarray)this, 0); | |
50 | + TR_darrPutAt((TR_Dynarray)this, TR_darrGet((TR_Dynarray)this, idx), 0); | |
51 | + TR_darrPutAt((TR_Dynarray)this, tmp, idx); | |
53 | 52 | idx = 0; |
54 | 53 | |
55 | 54 | while (left < ((TR_Dynarray)this)->size && |
... | ... | @@ -67,10 +66,12 @@ TR_heapGet(TR_Heap this) |
67 | 66 | if (0 > this->comp( |
68 | 67 | TR_darrGet((TR_Dynarray)this, idx), |
69 | 68 | TR_darrGet((TR_Dynarray)this, change))) { |
70 | - SWAP( | |
71 | - void *, | |
69 | + tmp = TR_darrGet((TR_Dynarray)this, change); | |
70 | + TR_darrPutAt( | |
71 | + (TR_Dynarray)this, | |
72 | 72 | TR_darrGet((TR_Dynarray)this, idx), |
73 | - TR_darrGet((TR_Dynarray)this, change)); | |
73 | + change); | |
74 | + TR_darrPutAt((TR_Dynarray)this, tmp, idx); | |
74 | 75 | idx = change; |
75 | 76 | left = (idx << 1) + 1; |
76 | 77 | right = left + 1; | ... | ... |
... | ... | @@ -36,12 +36,14 @@ TR_heapPut(TR_Heap this, const void * data) |
36 | 36 | size_t parent = (idx - 1) >> 1; |
37 | 37 | |
38 | 38 | if (0 > this->comp( |
39 | - TR_darrGet((TR_Dynarray)this, parent), | |
39 | + TR_darrGet((TR_Dynarray)this, parent), | |
40 | 40 | TR_darrGet((TR_Dynarray)this, idx))) { |
41 | - SWAP( | |
42 | - void *, | |
43 | - TR_darrGet((TR_Dynarray)this, parent), | |
44 | - TR_darrGet((TR_Dynarray)this, idx)); | |
41 | + const void * tmp = TR_darrGet((TR_Dynarray)this, parent); | |
42 | + TR_darrPutAt( | |
43 | + (TR_Dynarray)this, | |
44 | + TR_darrGet((TR_Dynarray)this, idx), | |
45 | + parent); | |
46 | + TR_darrPutAt((TR_Dynarray)this, tmp, idx); | |
45 | 47 | idx = parent; |
46 | 48 | } else { |
47 | 49 | break; | ... | ... |
Please
register
or
login
to post a comment