llvm.org GIT mirror llvm / c65fc3b
reenable array_pod_sort, this time hopefully happy on 64-bit and big endian systems. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60371 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 11 years ago
1 changed file(s) with 12 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
230230 return 1;
231231 return 0;
232232 }
233
234 /// get_array_pad_sort_comparator - This is an internal helper function used to
235 /// get type deduction of T right.
236 template
237 static int (*get_array_pad_sort_comparator(const T &X))
238 (const void*, const void*) {
239 return array_pod_sort_comparator;
240 }
241
233242
234243 /// array_pod_sort - This sorts an array with the specified start and end
235244 /// extent. This is just like std::sort, except that it calls qsort instead of
245254 ///
246255 /// NOTE: If qsort_r were portable, we could allow a custom comparator and
247256 /// default to std::less.
248 }
249 #include
250 namespace llvm {
251
252257 template
253258 static inline void array_pod_sort(IteratorTy Start, IteratorTy End) {
254 std::sort(Start, End);
255
256259 // Don't dereference start iterator of empty sequence.
257 //if (Start == End) return;
258 //qsort(&*Start, End-Start, sizeof(*Start),
259 // array_pod_sort_comparator<*Start>);
260 if (Start == End) return;
261 qsort(&*Start, End-Start, sizeof(*Start),
262 get_array_pad_sort_comparator(*Start));
260263 }
261264
262265 } // End llvm namespace