numpy  2.0.0
src/npysort/npysort_common.h File Reference
#include <stdlib.h>
#include <numpy/ndarraytypes.h>

Go to the source code of this file.

Defines

#define BOOL_SWAP(a, b)   {npy_bool tmp = (b); (b)=(a); (a) = tmp;}
#define BYTE_SWAP(a, b)   {npy_byte tmp = (b); (b)=(a); (a) = tmp;}
#define UBYTE_SWAP(a, b)   {npy_ubyte tmp = (b); (b)=(a); (a) = tmp;}
#define SHORT_SWAP(a, b)   {npy_short tmp = (b); (b)=(a); (a) = tmp;}
#define USHORT_SWAP(a, b)   {npy_ushort tmp = (b); (b)=(a); (a) = tmp;}
#define INT_SWAP(a, b)   {npy_int tmp = (b); (b)=(a); (a) = tmp;}
#define UINT_SWAP(a, b)   {npy_uint tmp = (b); (b)=(a); (a) = tmp;}
#define LONG_SWAP(a, b)   {npy_long tmp = (b); (b)=(a); (a) = tmp;}
#define ULONG_SWAP(a, b)   {npy_ulong tmp = (b); (b)=(a); (a) = tmp;}
#define LONGLONG_SWAP(a, b)   {npy_longlong tmp = (b); (b)=(a); (a) = tmp;}
#define ULONGLONG_SWAP(a, b)   {npy_ulonglong tmp = (b); (b)=(a); (a) = tmp;}
#define HALF_SWAP(a, b)   {npy_half tmp = (b); (b)=(a); (a) = tmp;}
#define FLOAT_SWAP(a, b)   {npy_float tmp = (b); (b)=(a); (a) = tmp;}
#define DOUBLE_SWAP(a, b)   {npy_double tmp = (b); (b)=(a); (a) = tmp;}
#define LONGDOUBLE_SWAP(a, b)   {npy_longdouble tmp = (b); (b)=(a); (a) = tmp;}
#define CFLOAT_SWAP(a, b)   {npy_cfloat tmp = (b); (b)=(a); (a) = tmp;}
#define CDOUBLE_SWAP(a, b)   {npy_cdouble tmp = (b); (b)=(a); (a) = tmp;}
#define CLONGDOUBLE_SWAP(a, b)   {npy_clongdouble tmp = (b); (b)=(a); (a) = tmp;}
#define DATETIME_SWAP(a, b)   {npy_datetime tmp = (b); (b)=(a); (a) = tmp;}
#define TIMEDELTA_SWAP(a, b)   {npy_timedelta tmp = (b); (b)=(a); (a) = tmp;}
#define INTP_SWAP(a, b)   {npy_intp tmp = (b); (b)=(a); (a) = tmp;}

Functions

static NPY_INLINE int BOOL_LT (npy_bool a, npy_bool b)
static NPY_INLINE int BYTE_LT (npy_byte a, npy_byte b)
static NPY_INLINE int UBYTE_LT (npy_ubyte a, npy_ubyte b)
static NPY_INLINE int SHORT_LT (npy_short a, npy_short b)
static NPY_INLINE int USHORT_LT (npy_ushort a, npy_ushort b)
static NPY_INLINE int INT_LT (npy_int a, npy_int b)
static NPY_INLINE int UINT_LT (npy_uint a, npy_uint b)
static NPY_INLINE int LONG_LT (npy_long a, npy_long b)
static NPY_INLINE int ULONG_LT (npy_ulong a, npy_ulong b)
static NPY_INLINE int LONGLONG_LT (npy_longlong a, npy_longlong b)
static NPY_INLINE int ULONGLONG_LT (npy_ulonglong a, npy_ulonglong b)
static NPY_INLINE int FLOAT_LT (npy_float a, npy_float b)
static NPY_INLINE int DOUBLE_LT (npy_double a, npy_double b)
static NPY_INLINE int LONGDOUBLE_LT (npy_longdouble a, npy_longdouble b)
static NPY_INLINE int npy_half_isnan (npy_half h)
static NPY_INLINE int npy_half_lt_nonan (npy_half h1, npy_half h2)
static NPY_INLINE int HALF_LT (npy_half a, npy_half b)
static NPY_INLINE int CFLOAT_LT (npy_cfloat a, npy_cfloat b)
static NPY_INLINE int CDOUBLE_LT (npy_cdouble a, npy_cdouble b)
static NPY_INLINE int CLONGDOUBLE_LT (npy_clongdouble a, npy_clongdouble b)
static NPY_INLINE void STRING_COPY (char *s1, char *s2, size_t len)
static NPY_INLINE void STRING_SWAP (char *s1, char *s2, size_t len)
static NPY_INLINE int STRING_LT (char *s1, char *s2, size_t len)
static NPY_INLINE void UNICODE_COPY (npy_ucs4 *s1, npy_ucs4 *s2, size_t len)
static NPY_INLINE void UNICODE_SWAP (npy_ucs4 *s1, npy_ucs4 *s2, size_t len)
static NPY_INLINE int UNICODE_LT (npy_ucs4 *s1, npy_ucs4 *s2, size_t len)
static NPY_INLINE int DATETIME_LT (npy_datetime a, npy_datetime b)
static NPY_INLINE int TIMEDELTA_LT (npy_timedelta a, npy_timedelta b)
static NPY_INLINE void GENERIC_COPY (char *a, char *b, size_t len)
static NPY_INLINE void GENERIC_SWAP (char *a, char *b, size_t len)

Define Documentation

#define BOOL_SWAP (   a,
 
)    {npy_bool tmp = (b); (b)=(a); (a) = tmp;}

* SWAP MACROS **

#define BYTE_SWAP (   a,
 
)    {npy_byte tmp = (b); (b)=(a); (a) = tmp;}
#define CDOUBLE_SWAP (   a,
 
)    {npy_cdouble tmp = (b); (b)=(a); (a) = tmp;}
#define CFLOAT_SWAP (   a,
 
)    {npy_cfloat tmp = (b); (b)=(a); (a) = tmp;}
#define CLONGDOUBLE_SWAP (   a,
 
)    {npy_clongdouble tmp = (b); (b)=(a); (a) = tmp;}
#define DATETIME_SWAP (   a,
 
)    {npy_datetime tmp = (b); (b)=(a); (a) = tmp;}
#define DOUBLE_SWAP (   a,
 
)    {npy_double tmp = (b); (b)=(a); (a) = tmp;}
#define FLOAT_SWAP (   a,
 
)    {npy_float tmp = (b); (b)=(a); (a) = tmp;}
#define HALF_SWAP (   a,
 
)    {npy_half tmp = (b); (b)=(a); (a) = tmp;}
#define INT_SWAP (   a,
 
)    {npy_int tmp = (b); (b)=(a); (a) = tmp;}
#define INTP_SWAP (   a,
 
)    {npy_intp tmp = (b); (b)=(a); (a) = tmp;}
Need this for the argsort functions

Referenced by suff().

#define LONG_SWAP (   a,
 
)    {npy_long tmp = (b); (b)=(a); (a) = tmp;}
#define LONGDOUBLE_SWAP (   a,
 
)    {npy_longdouble tmp = (b); (b)=(a); (a) = tmp;}
#define LONGLONG_SWAP (   a,
 
)    {npy_longlong tmp = (b); (b)=(a); (a) = tmp;}
#define SHORT_SWAP (   a,
 
)    {npy_short tmp = (b); (b)=(a); (a) = tmp;}
#define TIMEDELTA_SWAP (   a,
 
)    {npy_timedelta tmp = (b); (b)=(a); (a) = tmp;}
#define UBYTE_SWAP (   a,
 
)    {npy_ubyte tmp = (b); (b)=(a); (a) = tmp;}
#define UINT_SWAP (   a,
 
)    {npy_uint tmp = (b); (b)=(a); (a) = tmp;}
#define ULONG_SWAP (   a,
 
)    {npy_ulong tmp = (b); (b)=(a); (a) = tmp;}
#define ULONGLONG_SWAP (   a,
 
)    {npy_ulonglong tmp = (b); (b)=(a); (a) = tmp;}
#define USHORT_SWAP (   a,
 
)    {npy_ushort tmp = (b); (b)=(a); (a) = tmp;}

Function Documentation

static NPY_INLINE int BOOL_LT ( npy_bool  a,
npy_bool  b 
) [static]

* COMPARISON FUNCTIONS **

static NPY_INLINE int BYTE_LT ( npy_byte  a,
npy_byte  b 
) [static]
static NPY_INLINE int CDOUBLE_LT ( npy_cdouble  a,
npy_cdouble  b 
) [static]
static NPY_INLINE int CFLOAT_LT ( npy_cfloat  a,
npy_cfloat  b 
) [static]
For inline functions SUN recommends not using a return in the then part of an if statement. It's a SUN compiler thing, so assign the return value to a variable instead.
static NPY_INLINE int CLONGDOUBLE_LT ( npy_clongdouble  a,
npy_clongdouble  b 
) [static]
static NPY_INLINE int DATETIME_LT ( npy_datetime  a,
npy_datetime  b 
) [static]
static NPY_INLINE int DOUBLE_LT ( npy_double  a,
npy_double  b 
) [static]
static NPY_INLINE int FLOAT_LT ( npy_float  a,
npy_float  b 
) [static]
static NPY_INLINE void GENERIC_COPY ( char *  a,
char *  b,
size_t  len 
) [static]

Referenced by npy_mergesort0().

static NPY_INLINE void GENERIC_SWAP ( char *  a,
char *  b,
size_t  len 
) [static]
static NPY_INLINE int HALF_LT ( npy_half  a,
npy_half  b 
) [static]

References npy_half_isnan().

static NPY_INLINE int INT_LT ( npy_int  a,
npy_int  b 
) [static]
static NPY_INLINE int LONG_LT ( npy_long  a,
npy_long  b 
) [static]
static NPY_INLINE int LONGDOUBLE_LT ( npy_longdouble  a,
npy_longdouble  b 
) [static]
static NPY_INLINE int LONGLONG_LT ( npy_longlong  a,
npy_longlong  b 
) [static]
static NPY_INLINE int npy_half_isnan ( npy_half  h) [static]
static NPY_INLINE int npy_half_lt_nonan ( npy_half  h1,
npy_half  h2 
) [static]
Signed zeros are equal, have to check for it
static NPY_INLINE int SHORT_LT ( npy_short  a,
npy_short  b 
) [static]
static NPY_INLINE void STRING_COPY ( char *  s1,
char *  s2,
size_t  len 
) [static]
static NPY_INLINE int STRING_LT ( char *  s1,
char *  s2,
size_t  len 
) [static]
static NPY_INLINE void STRING_SWAP ( char *  s1,
char *  s2,
size_t  len 
) [static]
static NPY_INLINE int TIMEDELTA_LT ( npy_timedelta  a,
npy_timedelta  b 
) [static]
static NPY_INLINE int UBYTE_LT ( npy_ubyte  a,
npy_ubyte  b 
) [static]
static NPY_INLINE int UINT_LT ( npy_uint  a,
npy_uint  b 
) [static]
static NPY_INLINE int ULONG_LT ( npy_ulong  a,
npy_ulong  b 
) [static]
static NPY_INLINE int ULONGLONG_LT ( npy_ulonglong  a,
npy_ulonglong  b 
) [static]
static NPY_INLINE void UNICODE_COPY ( npy_ucs4 *  s1,
npy_ucs4 *  s2,
size_t  len 
) [static]
static NPY_INLINE int UNICODE_LT ( npy_ucs4 *  s1,
npy_ucs4 *  s2,
size_t  len 
) [static]
static NPY_INLINE void UNICODE_SWAP ( npy_ucs4 *  s1,
npy_ucs4 *  s2,
size_t  len 
) [static]
static NPY_INLINE int USHORT_LT ( npy_ushort  a,
npy_ushort  b 
) [static]