| Index: src/platform/vboot_reference/cgptlib/quick_sort.h
|
| diff --git a/src/platform/vboot_reference/cgptlib/quick_sort.h b/src/platform/vboot_reference/cgptlib/quick_sort.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..260be1af36c76713a02303731b02616de41a3aba
|
| --- /dev/null
|
| +++ b/src/platform/vboot_reference/cgptlib/quick_sort.h
|
| @@ -0,0 +1,23 @@
|
| +/* Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
|
| + * Use of this source code is governed by a BSD-style license that can be
|
| + * found in the LICENSE file.
|
| + */
|
| +#ifndef VBOOT_REFERENCE_QSORT_H_
|
| +#define VBOOT_REFERENCE_QSORT_H_
|
| +
|
| +#define MAX_QUICK_SORT_ELEMENT_SIZE 512
|
| +
|
| +/* QuickSort() is an in-place, and unstable quick sort implementation.
|
| + * Given a compare function, this function sorts elements for you.
|
| + * 'elements' points to the base of un-sorted array.
|
| + * 'number_of_elements' indicates the number of elements in array.
|
| + * 'size' indicates the size (in bytes) of an element unit.
|
| + * The 'compare_function' should return true if 'a' precedes 'b'.
|
| + *
|
| + * NOTE: For performance issue, we reserve a static buffer for swap.
|
| + * So that the 'size' cannot exceed the buffer size
|
| + * (MAX_QUICK_SORT_ELEMENT_SIZE). */
|
| +void QuickSort(void *elements, int number_of_elements, int size,
|
| + int (*compare_function)(const void *a, const void *b));
|
| +
|
| +#endif /* VBOOT_REFERENCE_QSORT_H_ */
|
|
|