|
@@ -48,9 +48,11 @@ i64 getNanos(void);
|
|
// TODO: replace typeof with auto when available
|
|
// TODO: replace typeof with auto when available
|
|
#define swap(a, b) \
|
|
#define swap(a, b) \
|
|
do { \
|
|
do { \
|
|
- typeof(*(a)) tmp = *(a); \
|
|
|
|
- *(a) = *(b); \
|
|
|
|
- *(b) = tmp; \
|
|
|
|
|
|
+ typeof(a) aPointer = (a); \
|
|
|
|
+ typeof(b) bPointer = (b); \
|
|
|
|
+ typeof(*aPointer) tmp = *aPointer; \
|
|
|
|
+ *aPointer = *bPointer; \
|
|
|
|
+ *bPointer = tmp; \
|
|
} while(0)
|
|
} while(0)
|
|
|
|
|
|
#endif
|
|
#endif
|