mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Added Innobase to source distribution
Docs/manual.texi: Added Innobase documentation configure.in: Incremented version include/my_base.h: Added option for Innobase myisam/mi_check.c: cleanup mysql-test/t/bdb.test: cleanup mysql-test/t/innobase.test: Extended with new tests from bdb.test mysql-test/t/merge.test: Added test of SHOW create mysys/my_init.c: Fix for UNIXWARE 7 scripts/mysql_install_db.sh: Always write how to start mysqld scripts/safe_mysqld.sh: Fixed type sql/ha_innobase.cc: Update to new version sql/ha_innobase.h: Update to new version sql/handler.h: Added 'update_table_comment()' and 'append_create_info()' sql/sql_delete.cc: Fixes for Innobase sql/sql_select.cc: Fixes for Innobase sql/sql_show.cc: Append create information (for MERGE tables) sql/sql_update.cc: Fixes for Innobase
This commit is contained in:
91
innobase/include/ut0sort.h
Normal file
91
innobase/include/ut0sort.h
Normal file
@ -0,0 +1,91 @@
|
||||
/**********************************************************************
|
||||
Sort utility
|
||||
|
||||
(c) 1995 Innobase Oy
|
||||
|
||||
Created 11/9/1995 Heikki Tuuri
|
||||
***********************************************************************/
|
||||
|
||||
#ifndef ut0sort_h
|
||||
#define ut0sort_h
|
||||
|
||||
#include "univ.i"
|
||||
|
||||
/* This module gives a macro definition of the body of
|
||||
a standard sort function for an array of elements of any
|
||||
type. The comparison function is given as a parameter to
|
||||
the macro. The sort algorithm is mergesort which has logarithmic
|
||||
worst case.
|
||||
*/
|
||||
|
||||
/***********************************************************************
|
||||
This macro expands to the body of a standard sort function.
|
||||
The sort function uses mergesort and must be defined separately
|
||||
for each type of array.
|
||||
Also the comparison function has to be defined individually
|
||||
for each array cell type. SORT_FUN is the sort function name.
|
||||
The function takes the array to be sorted (ARR),
|
||||
the array of auxiliary space (AUX_ARR) of same size,
|
||||
and the low (LOW), inclusive, and high (HIGH), noninclusive,
|
||||
limits for the sort interval as arguments.
|
||||
CMP_FUN is the comparison function name. It takes as arguments
|
||||
two elements from the array and returns 1, if the first is bigger,
|
||||
0 if equal, and -1 if the second bigger. For an eaxmaple of use
|
||||
see test program in tsut.c. */
|
||||
|
||||
#define UT_SORT_FUNCTION_BODY(SORT_FUN, ARR, AUX_ARR, LOW, HIGH, CMP_FUN)\
|
||||
{\
|
||||
ulint ut_sort_mid77;\
|
||||
ulint ut_sort_i77;\
|
||||
ulint ut_sort_low77;\
|
||||
ulint ut_sort_high77;\
|
||||
\
|
||||
ut_ad((LOW) < (HIGH));\
|
||||
ut_ad(ARR);\
|
||||
ut_ad(AUX_ARR);\
|
||||
\
|
||||
if ((LOW) == (HIGH) - 1) {\
|
||||
return;\
|
||||
} else if ((LOW) == (HIGH) - 2) {\
|
||||
if (CMP_FUN((ARR)[LOW], (ARR)[(HIGH) - 1]) > 0) {\
|
||||
(AUX_ARR)[LOW] = (ARR)[LOW];\
|
||||
(ARR)[LOW] = (ARR)[(HIGH) - 1];\
|
||||
(ARR)[(HIGH) - 1] = (AUX_ARR)[LOW];\
|
||||
}\
|
||||
return;\
|
||||
}\
|
||||
\
|
||||
ut_sort_mid77 = ((LOW) + (HIGH)) / 2;\
|
||||
\
|
||||
SORT_FUN((ARR), (AUX_ARR), (LOW), ut_sort_mid77);\
|
||||
SORT_FUN((ARR), (AUX_ARR), ut_sort_mid77, (HIGH));\
|
||||
\
|
||||
ut_sort_low77 = (LOW);\
|
||||
ut_sort_high77 = ut_sort_mid77;\
|
||||
\
|
||||
for (ut_sort_i77 = (LOW); ut_sort_i77 < (HIGH); ut_sort_i77++) {\
|
||||
\
|
||||
if (ut_sort_low77 >= ut_sort_mid77) {\
|
||||
(AUX_ARR)[ut_sort_i77] = (ARR)[ut_sort_high77];\
|
||||
ut_sort_high77++;\
|
||||
} else if (ut_sort_high77 >= (HIGH)) {\
|
||||
(AUX_ARR)[ut_sort_i77] = (ARR)[ut_sort_low77];\
|
||||
ut_sort_low77++;\
|
||||
} else if (CMP_FUN((ARR)[ut_sort_low77],\
|
||||
(ARR)[ut_sort_high77]) > 0) {\
|
||||
(AUX_ARR)[ut_sort_i77] = (ARR)[ut_sort_high77];\
|
||||
ut_sort_high77++;\
|
||||
} else {\
|
||||
(AUX_ARR)[ut_sort_i77] = (ARR)[ut_sort_low77];\
|
||||
ut_sort_low77++;\
|
||||
}\
|
||||
}\
|
||||
\
|
||||
for (ut_sort_i77 = (LOW); ut_sort_i77 < (HIGH); ut_sort_i77++) {\
|
||||
(ARR)[ut_sort_i77] = (AUX_ARR)[ut_sort_i77];\
|
||||
}\
|
||||
}\
|
||||
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user