1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3
4<head>
5<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
6<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 8.0.0.0 for Windows">
7<META http-equiv="Content-Style-Type" content="text/css">
8<title>MATH_QSort</title>
9<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css">
10</head>
11
12<body>
13
14<h1 align="left">MATH_QSort <img src="../../image/NTR.gif"align="middle"><img src="../../image/TWL.gif" align="middle"></H1>
15<H2>Syntax</H2>
16
17<dl>
18  <dd>
19  <PRE><CODE>#include &lt;nitro/math/qsort.h&gt;
20
21void MATH_QSort( void *head,
22                    u32   num,
23                    u32 width,
24                    <A href="MATHCompareFunc.html">MATHCompareFunc</A> comp,
25                    void *stackBuf );<BR>
26</CODE></PRE>
27  </dd>
28</dl><h2>Arguments</h2>
29
30<table border="1" width="100%">
31
32
33
34    <TR>
35      <TD width="176"><em><strong><font face="Courier New">head</font></strong></em></TD>
36      <TD width="670">Pointer to the data to sort.</TD>
37    </TR>
38    <TR>
39      <TD><em><strong><font face="Courier New">num</font></strong></em></TD>
40      <TD>The number of pieces of data to sort.</TD>
41    </TR>
42    <TR>
43      <TD><em><strong><font face="Courier New">width</font></strong></em></TD>
44      <TD>The size of each piece of data.</TD>
45    </TR>
46    <TR>
47      <TD><em><strong><font face="Courier New">comp</font></strong></em></TD>
48      <TD>Comparison function for the elements in the array.</TD>
49    </TR>
50    <TR>
51      <TD><em><strong><font face="Courier New">stackBuf</font></strong></em></TD>
52      <TD>Provides a buffer to be used internally. You can obtain the required buffer size with the <CODE><A href="MATH_QSortStackSize.html">MATH_QSortStackSize</A></CODE> function.<BR>
53      If this argument is NULL, memory will be allocated from the stack. Be alert to the possiblity of stack overflow.</TD>
54    </TR>
55  </table>
56<h2>Return Values</h2>
57<p>None.</p>
58<H2>Description</H2>
59<P>This function performs a quicksort.<BR> The function does not use a recursive call. Instead, the <em><strong><code>stackBuf</code></strong></em> argument must be used to provide a work area for the sort.<BR> If the work area is provided by NULL, the stack will be used for the sort. Be aware of the possiblity of stack overflow.<BR> The required size of the work area is <CODE>(Log2(num)+1)*8</CODE> bytes. This value can be obtained with the <CODE><A href="MATH_QSortStackSize.html">MATH_QSortStackSize</A></CODE> function.
60</P>
61<h2>See Also</h2>
62<P><CODE><A href="MATH_QSortStackSize.html">MATH_QSortStackSize</A>, <A href="MATHCompareFunc.html">MATHCompareFunc</A></CODE></P>
63<H2>Revision History</H2>
64<P>2005/04/12 Initial version.</P>
65<hr><p>CONFIDENTIAL</p></body>
66</html>
67