Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/KaisenAmin/c_std
/ functions
Functions
2,651 in github.com/KaisenAmin/c_std
⨍
Functions
2,651
◇
Types & classes
138
Function
sort_binary_search
* @brief Locate `target` in a sorted array via binary search. * * The array must already be sorted according to `compare`. * * @param array Sort
sort/sort.c:1688
Function
sort_binary_search_range
* @brief Find the contiguous range of elements equal to `target` in a sorted * array. Equivalent to C++'s `std::equal_range`. * * @param arr
sort/sort.c:2182
Function
sort_compare_double
* @brief Default comparator for `double*` elements. * * @param a Pointer to the first double. * @param b Pointer to the second double. * @return N
sort/sort.c:171
Function
sort_compare_float
* @brief Default comparator for `float*` elements. * * @param a Pointer to the first float. * @param b Pointer to the second float. * @return Nega
sort/sort.c:137
Function
sort_compare_int
* @brief Default comparator for `int*` elements. * * Dereferences both arguments as `int*` and returns standard three-way * comparison. NULL is tre
sort/sort.c:77
Function
sort_compare_pointer
* @brief Comparator that orders elements by their raw pointer address. * * Useful when the user wants a stable but arbitrary ordering keyed on * id
sort/sort.c:209
Function
sort_compare_string
* @brief Default comparator for null-terminated strings (`char*` elements). * * Delegates to `strcmp`. NULL is treated as the minimum value. * * @
sort/sort.c:113
Function
sort_heap_extract_max
* @brief Remove and return the maximum element from a max-heap. * * Swaps the root with the last element, decrements `*size`, and re-heapifies * fr
sort/sort.c:2034
Function
sort_heap_insert
* @brief Insert an element into a max-heap stored as an array. * * Appends `element` at the next free slot (`array[*size]`), then sifts it up * to
sort/sort.c:1999
Function
sort_is_sorted
* @brief Check whether an array is sorted in non-decreasing order. * * Empty arrays and single-element arrays are considered sorted. * * @param ar
sort/sort.c:1050
Function
sort_is_sorted_until
* @brief Return the index of the first element that is out of order — the end * of the longest sorted prefix (analog of `std::is_sorted_until`
sort/sort.c:1083
Function
sort_median
* @brief Returns the median element of the array. * * Computes the element at position `size/2` after a quickselect partitioning. * For even-length
sort/sort.c:2159
Function
sort_merge_inplace
* @brief In-place merge of two adjacent sorted sub-ranges. * * Merges `array[left..mid]` and `array[mid+1..right]` (both assumed sorted) * back int
sort/sort.c:1898
Function
sort_merge_sorted_arrays
* @brief Merge two already-sorted external arrays into one sorted array. * * Allocates a brand-new array of `size1 + size2` element pointers and fil
sort/sort.c:1943
Function
sort_parallel_mergesort
* @brief Single-threaded placeholder for a parallel mergesort. * * The current implementation simply delegates to `sort_mergesort_optimized`. * Res
sort/sort.c:1558
Function
sort_parallel_quicksort
* @brief Single-threaded placeholder for a parallel quicksort. * * Delegates to `sort_quicksort_optimized`. Reserved for a future task-based * para
sort/sort.c:1576
Function
sort_partial_sort
* @brief Partially sort an array so the smallest `k` elements occupy the first * `k` positions in sorted order. The rest of the array is left
sort/sort.c:2067
Function
sort_partition_three_way
* @brief Three-way partition (Dutch national flag) around `pivot`. * * Reorders elements in `array[left..right]` so that elements less than `pivot`
sort/sort.c:1812
Function
sort_print_array
* @brief Print an array as `[e0, e1, ...]` using a per-element callback. * * The callback is one of `sort_print_int` / `sort_print_string` / etc., o
sort/sort.c:1373
Function
sort_print_double
* @brief Default print callback for `double*` elements (2 decimal places). * @param element Pointer to the double to print. */
sort/sort.c:306
Function
sort_print_float
* @brief Default print callback for `float*` elements (2 decimal places). * @param element Pointer to the float to print. */
sort/sort.c:292
Function
sort_print_int
* @brief Default print callback for `int*` elements. * Used by `sort_print_array`. Prints "NULL" for null pointers. * @param element Pointer
sort/sort.c:264
Function
sort_print_pointer
* @brief Default print callback that emits the raw pointer address. * @param element The pointer to print. */
sort/sort.c:320
Function
sort_print_stats
* @brief Print a `SortStats` block as a human-readable multi-line block. * * Shows comparison count, swap count, recursive-call count, execution tim
sort/sort.c:1399
Function
sort_print_string
* @brief Default print callback for null-terminated string elements. * Wraps the string in double quotes. * @param element Pointer to a C str
sort/sort.c:278
Function
sort_reset_stats
* @brief Reset a `SortStats` block back to zero. Alias for `sort_init_stats`. * @param stats Stats block to reset. */
sort/sort.c:1420
Function
sort_reverse
* @brief Reverse the order of elements in-place. * * Swaps element `i` with element `size - 1 - i` for the first half of the * array. NULL or singl
sort/sort.c:1160
Function
sort_shuffle
* @brief Randomly permute the array in place via Fisher-Yates shuffle. * * Seeds `rand()` with the current time on each call, then performs `n-1` *
sort/sort.c:1184
Function
sort_stable_heapsort
* @brief Stable sort with heapsort-like API. * * Heapsort isn't stable, so this also delegates to `sort_mergesort`. * * @param array Array of el
sort/sort.c:1612
Function
sort_stable_quicksort
* @brief Stable sort with quicksort-like API. * * Because quicksort itself isn't stable, this routes to `sort_mergesort`, * which is. Useful as a d
sort/sort.c:1595
Function
sort_swap_generic
* @brief Default swap function for slot-based element arrays. * * Treats both arguments as `ElementType*` (i.e. addresses of slots in an * `Element
sort/sort.c:244
Function
sort_timsort
* @brief Simplified Timsort placeholder. * * Real Timsort detects natural runs and merges them stably, providing very * fast performance on partial
sort/sort.c:1667
Function
sort_unique
* @brief Remove consecutive duplicate elements in-place, keeping the first of * each run (analog of `std::unique`). * * This is the second h
sort/sort.c:1128
Function
span_at
* @brief Bounds-checked element pointer. * * @param s Span pointer. * @param index Zero-based element index. * * @return Pointer to element @
span/span.c:234
Function
span_back
* @brief Pointer to the last element of the span. * * @param s Span pointer. * @return `data + (size - 1) * elemSize` for a non-empty span, NULL *
span/span.c:271
Function
span_begin
* @brief Pointer to the first element of the span. NULL-safe. * * Equivalent to `s->data` (or NULL when `s == NULL`). * * @param s Span pointer.
span/span.c:591
Function
span_cbegin
* @brief Read-only @ref span_begin. * * @param s Span pointer. * @return Begin pointer as `const void*`. */
span/span.c:606
Function
span_cdata
* @brief Read-only raw data pointer. * * @param s Span pointer. * @return `s->data` (as `const void*`) or NULL. */
span/span.c:303
Function
span_cend
* @brief Read-only @ref span_end. * * @param s Span pointer. * @return End pointer as `const void*`. */
span/span.c:651
Function
span_crbegin
* @brief Read-only @ref span_rbegin. * * @param s Span pointer. * @return Pointer to the last element as `const void*`, or NULL. */
span/span.c:696
Function
span_create
* @brief Allocate a Span on the heap that points at user-owned `data`. * * The Span struct itself is heap-allocated (so it can be returned by * poi
span/span.c:109
Function
span_crend
* @brief Read-only reverse-end sentinel — always NULL. * * See @ref span_rend for the rationale. * * @param s Ignored. * @return NULL. */
span/span.c:743
Function
span_data
* @brief Raw mutable data pointer (may be NULL for an empty span). * * @param s Span pointer. * @return `s->data` or NULL. */
span/span.c:289
Function
span_decrement
* @brief Step backward one element from @p ptr. * * Valid inputs are pointers in `(span_begin(s), span_end(s)]` — i.e. * any element except the fir
span/span.c:803
Function
span_destroy
* @brief Frees the heap allocation made by @ref span_create. * * Does NOT free the pointee — Span is non-owning. NULL-safe. * * @param span Span r
span/span.c:139
Function
span_elem_size
* @brief Bytes per element. * * @param s Span pointer. NULL returns 0. * @return Size of one element in bytes, as supplied to the constructor. */
span/span.c:198
Function
span_empty
* @brief Returns true if the span has no elements (or is NULL). * * @param s Span pointer. NULL is treated as empty (returns true). * @return true
span/span.c:212
Function
span_end
* @brief One-past-the-end pointer. * * For an empty span returns `s->data` (which may be NULL); this is * legal per the C standard for `T*` arithme
span/span.c:628
Function
span_first
* @brief Returns a span over the first @p count elements. * * Behavior: * - `count <= s->size` → span of @p count elements starting at *
span/span.c:325
Function
span_front
* @brief Pointer to the first element of the span. * * @param s Span pointer. * @return Same as `s->data` for a non-empty span, NULL otherwise. */
span/span.c:253
Function
span_increment
* @brief Step forward one element from @p ptr. * * @p ptr must point at an element currently inside the span (i.e. * in `[span_begin(s), span_end(s
span/span.c:766
Function
span_is_greater
* @brief Lexicographic greater-than. Equivalent to * `span_is_less(b, a)`. * * @param a Left span. * @param b Right span. * @return true i
span/span.c:516
Function
span_is_greater_or_equal
* @brief Greater-than-or-equal. * * @param a Left span. * @param b Right span. * @return `span_is_greater(a, b) || span_is_equal(a, b)`. */
span/span.c:563
Function
span_is_less
* @brief Lexicographic less-than over the raw bytes. * * Behavior matches `std::lexicographical_compare` over the byte * representations: * - Co
span/span.c:495
Function
span_is_less_or_equal
* @brief Less-than-or-equal. * * @param a Left span. * @param b Right span. * @return `span_is_less(a, b) || span_is_equal(a, b)`. */
span/span.c:536
Function
span_is_not_equal
* @brief Inverse of @ref span_is_equal. * * @param a Left span. * @param b Right span. * @return `!span_is_equal(a, b)`. */
span/span.c:474
Function
span_last
* @brief Returns a span over the last @p count elements. * * Behavior: * - `count <= s->size` → span of @p count elements ending at the *
span/span.c:362
Function
span_rbegin
* @brief Pointer to the LAST element (the "first" of the reverse walk). * * The natural reverse-iteration loop: * * @param s Span pointer. * @ret
span/span.c:677
Function
span_rend
* @brief Reverse-end sentinel — always NULL. * * **Why always NULL?** The symmetric "one-before-the-first" pointer * (`data - elemSize`) is **undef
span/span.c:729
Function
span_size
* @brief Number of elements visible through @p s (NOT bytes). * * @param s Span pointer. NULL returns 0. * @return Element count, mirroring `std::s
span/span.c:156
Function
span_size_bits
* @brief Total size in bits (`size_bytes * CHAR_BIT`). * * @param s Span pointer. NULL returns 0. * @return Bit count of all elements combined. */
span/span.c:184
Function
span_size_bytes
* @brief Total size in bytes (`size * elemSize`). * * @param s Span pointer. NULL returns 0. * @return Byte count of all elements combined. */
span/span.c:170
Function
span_subspan
* @brief Returns a sub-span starting at @p offset for @p count elements. * * Behavior: * - `offset > s->size` OR `count > s->size - offset` *
span/span.c:399
Function
span_view
* @brief Build a non-owning Span value (std::span style — no heap, no copy). * * Semantics: * - `(data != NULL, elemCount > 0, elemSize > 0)` → v
span/span.c:61
Function
stack_assign
* @brief Replace `dest`'s contents with a deep copy of `src`. * @return true on success. */
stack/stack.c:92
Function
stack_capacity
@brief Storage capacity of the underlying vector. */
stack/stack.c:144
Function
stack_clear
@brief Drop every element; the stack becomes empty. */
stack/stack.c:181
Function
stack_copy
* @brief Deep-copy an existing stack. * @return New stack with the same contents, or NULL on failure. */
stack/stack.c:54
Function
stack_emplace
* @brief Like push, but returns a pointer to the newly-installed top * element. NULL on failure. */
stack/stack.c:165
Function
stack_empty
stack/stack.h:64
Function
stack_is_greater_or_equal
@brief Greater-than or equal. */
stack/stack.c:274
Function
stack_is_less_or_equal
@brief Less-than or equal. */
stack/stack.c:268
Function
stack_is_not_equal
@brief Inverse of stack_is_equal. */
stack/stack.c:243
Function
stack_item_size
@brief Size in bytes of each element. */
stack/stack.c:153
Function
stack_pop
stack/stack.h:108
Function
stack_pop_value
stack/stack.h:94
Function
stack_pop_void
stack/stack.h:85
Function
stack_push
stack/stack.h:77
Function
stack_reserve
@brief Pre-allocate storage for at least @p new_capacity elements. */
stack/stack.c:192
Function
stack_size
------------------------------------------------------------------ */ Inlined hot ops */ ----------
stack/stack.h:59
Function
stack_swap
* @brief Constant-time swap of two stacks' internals. * * Rejects (no-op) when item sizes differ, since C++ std::stack::swap * is only well-defined
stack/stack.c:212
Function
stack_top
stack/stack.h:69
Function
statistics_compare_counts
* @brief Compares two elements of the type __StatisticsElementCount based on their count field. * This function is used to sort elements by their fr
statistics/statistics.c:128
Function
statistics_compare_doubles
* @brief Compares two double values. It returns -1 if the first value is less than the second, * 1 if the first value is greater than the second, and
statistics/statistics.c:147
Function
statistics_compare_index_struct
* @brief A comparator function used for sorting __StatisticsIndexedValue structures, * which hold both the original value and its index in the datas
statistics/statistics.c:171
Function
statistics_correlation
* @brief This function calculates the correlation coefficient between the given data points. It supports * both Pearson's linear correlation and Spea
statistics/statistics.c:1247
Function
statistics_covariance
* @brief This function calculates the covariance between the given data points. * Covariance is a measure of how much two random variables vary toget
statistics/statistics.c:1201
Function
statistics_fmean
* @brief This function calculates the arithmetic mean (average) of the given data points. * Optionally, it can use weights to compute the weighted ar
statistics/statistics.c:845
Function
statistics_geometric_mean
* @brief This function calculates the geometric mean of the given data points. * The geometric mean is the nth root of the product of n numbers. *
statistics/statistics.c:902
Function
statistics_harmonic_mean
* @brief This function calculates the harmonic mean of the given data points. Optionally, it can use * weights to compute the weighted harmonic mean.
statistics/statistics.c:958
Function
statistics_linear_regression
* @brief This function performs linear regression on the given data points. If `proportional` is `true`, * the regression line is forced through the
statistics/statistics.c:1329
Function
statistics_median
* @brief This function calculates the median of the given data points. * The median is the middle value when the data is sorted in ascending order.
statistics/statistics.c:356
Function
statistics_median_grouped
* @brief This function calculates the grouped median of the given data points using a specified interval. * * @param data Pointer to an array of dou
statistics/statistics.c:507
Function
statistics_median_high
* @brief This function calculates the high median of the given data points. * The high median is the larger of the two middle values in an even-sized
statistics/statistics.c:461
Function
statistics_median_low
* @brief This function calculates the low median of the given data points. * The low median is the smaller of the two middle values in an even-sized
statistics/statistics.c:409
Function
statistics_mode
* @brief This function computes the mode of the given data set. If there are multiple elements with the same highest * frequency, one of them is retu
statistics/statistics.c:1025
Function
statistics_multimode
* @brief This function computes the modes of the given data set If there are multiple elements with the highest frequency, * all of them are returned
statistics/statistics.c:1098
Function
statistics_percentile
* @brief Compute the p-th percentile of a data set by linear interpolation. * * Sorts a copy of `data`, then interpolates between the two closest ra
statistics/statistics.c:586
Function
statistics_pstdev
* @brief This function calculates the population standard deviation of the given data points. * Optionally, it can use a provided mean (mu) instead o
statistics/statistics.c:815
Function
statistics_quantiles
* @brief Divide data into `n_quantiles` equal-probability intervals (Python's * statistics.quantiles), returning the `n_quantiles - 1` cut poi
statistics/statistics.c:644
← previous
next →
2,101–2,200 of 2,651, ranked by callers