Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1100)

Unified Diff: src/platform/vboot_reference/cgptlib/quick_sort.h

Issue 1701017: Add more test cases for GptInit() and fixed some bugs (Closed)
Patch Set: refine for code review Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/platform/vboot_reference/cgptlib/gpt.h ('k') | src/platform/vboot_reference/cgptlib/quick_sort.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_ */
« no previous file with comments | « src/platform/vboot_reference/cgptlib/gpt.h ('k') | src/platform/vboot_reference/cgptlib/quick_sort.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698