src/ucx/array.h

branch
feature/array
changeset 342
8f0a3c00d1d2
parent 339
ae368664625f
child 343
c09da4ee177f
     1.1 --- a/src/ucx/array.h	Thu Jul 11 10:11:43 2019 +0200
     1.2 +++ b/src/ucx/array.h	Tue Aug 06 16:26:46 2019 +0200
     1.3 @@ -199,64 +199,6 @@
     1.4  void *ucx_array_at(UcxArray array, size_t index);
     1.5  
     1.6  /**
     1.7 - * Returns an element of the specified type by value.
     1.8 - * 
     1.9 - * This expression can also be assigned to.
    1.10 - * 
    1.11 - * If <code>sizeof(type)</code> does not equal the array's element size, the
    1.12 - * behavior is undefined.
    1.13 - * If the index is out of bounds, the behavior is undefined.
    1.14 - * 
    1.15 - * @param type the type of the element
    1.16 - * @param array the array to retrieve the element from
    1.17 - * @param index index of the element to return
    1.18 - * @return the requested element
    1.19 - * @see ucx_array_at()
    1.20 - */
    1.21 -#define ucx_array_at_typed(type, array, index) (((type*)((array).data))[index])
    1.22 -
    1.23 -/**
    1.24 - * Shorthand for ucx_array_at_typed().
    1.25 - */
    1.26 -#define ucx_array_at_int(arr, i) ucx_array_at_typed(int, arr, i)
    1.27 -
    1.28 -/**
    1.29 - * Shorthand for ucx_array_at_typed().
    1.30 - */
    1.31 -#define ucx_array_at_short(arr, i) ucx_array_at_typed(short, arr, i)
    1.32 -
    1.33 -/**
    1.34 - * Shorthand for ucx_array_at_typed().
    1.35 - */
    1.36 -#define ucx_array_at_longint(arr, i) ucx_array_at_typed(long int, arr, i)
    1.37 -
    1.38 -/**
    1.39 - * Shorthand for ucx_array_at_typed().
    1.40 - */
    1.41 -#define ucx_array_at_uint(arr, i) ucx_array_at_typed(unsigned int, arr, i)
    1.42 -
    1.43 -/**
    1.44 - * Shorthand for ucx_array_at_typed().
    1.45 - */
    1.46 -#define ucx_array_at_ushort(arr, i) ucx_array_at_typed(unsigned short, arr, i)
    1.47 -
    1.48 -/**
    1.49 - * Shorthand for ucx_array_at_typed().
    1.50 - */
    1.51 -#define ucx_array_at_ulongint(arr, i) \
    1.52 -    ucx_array_at_typed(unsigned long int, arr, i)
    1.53 -
    1.54 -/**
    1.55 - * Shorthand for ucx_array_get_typed().
    1.56 - */
    1.57 -#define ucx_array_get_float(arr, i) ucx_array_get_typed(float, arr, i)
    1.58 -
    1.59 -/**
    1.60 - * Shorthand for ucx_array_get_typed().
    1.61 - */
    1.62 -#define ucx_array_get_double(arr, i) ucx_array_get_typed(double, arr, i)
    1.63 -
    1.64 -/**
    1.65   * Returns the index of an element containing the specified data.
    1.66   *
    1.67   * This function uses a cmp_func() to compare the data of each list element
    1.68 @@ -290,9 +232,14 @@
    1.69  int ucx_array_contains(UcxArray array, void *elem, cmp_func cmpfnc, void *data);
    1.70  
    1.71  /**
    1.72 - * Sorts a UcxArray with an almost in-place merge sort.
    1.73 + * Sorts a UcxArray with the best available sort algorithm.
    1.74   * 
    1.75 - * This function uses additional memory for exactly one element.
    1.76 + * If present, qsort_s() will be used. Otherwise, if no additional data is
    1.77 + * specified, qsort() is used as a fall back.
    1.78 + * 
    1.79 + * If qsort_s() is not available and <code>data</code> is not <code>NULL</code>,
    1.80 + * a custom almost in-place merge sort algorithm is used, which uses additional
    1.81 + * memory for exactly one element.
    1.82   * 
    1.83   * @param array the array to sort
    1.84   * @param cmpfnc the function that shall be used to compare the element data

mercurial