mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-20 04:09:16 +00:00
Remove more unused pnUtils code.
This commit is contained in:
@ -191,50 +191,4 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* BSEARCH
|
||||
*
|
||||
* This macro binary searches a sorted array to find an existing entry or
|
||||
* the position where a new entry should be placed. It returns the index of
|
||||
* the first entry for which the expression is false (zero or negative), or
|
||||
* count if the expression is true (positive) for all entries.
|
||||
*
|
||||
* Typically the expression will return:
|
||||
* > 0 if (sortKey > elem)
|
||||
* <= 0 if (sortKey <= elem)
|
||||
*
|
||||
* The final parameter to the macro is the address of a variable which is
|
||||
* filled with the resulting index.
|
||||
*
|
||||
***/
|
||||
|
||||
//===========================================================================
|
||||
#define BSEARCH(T, ptr, count, expr, addrOfIndex) { \
|
||||
\
|
||||
const T * low = (ptr); \
|
||||
const T * high = (ptr) + (count); /* first entry for which */ \
|
||||
/* expr is false */ \
|
||||
\
|
||||
if (low != high) \
|
||||
for (;;) { \
|
||||
const T & elem = *(low + (high - low) / 2); \
|
||||
int result = (expr); \
|
||||
if (result > 0) { \
|
||||
if (&elem == low) \
|
||||
break; \
|
||||
low = &elem; \
|
||||
} \
|
||||
else { \
|
||||
high = &elem; \
|
||||
if (&elem == low) \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
*(addrOfIndex) = high - (ptr); \
|
||||
\
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user