LCOV - code coverage report
Current view: top level - src/utility - LG_qsort_1a.c (source / functions) Hit Total Coverage
Test: LAGraph code coverage report. Commit id: 3b461aa. Current time (UTC): 2024-01-25T16:04:32Z Lines: 4 4 100.0 %
Date: 2024-01-25 16:05:28 Functions: 1 1 100.0 %

          Line data    Source code
       1             : //------------------------------------------------------------------------------
       2             : // LG_qsort_1a: sort an 1-by-n list of integers
       3             : //------------------------------------------------------------------------------
       4             : 
       5             : // LAGraph, (c) 2019-2022 by The LAGraph Contributors, All Rights Reserved.
       6             : // SPDX-License-Identifier: BSD-2-Clause
       7             : //
       8             : // For additional details (including references to third party source code and
       9             : // other files) see the LICENSE file or contact permission@sei.cmu.edu. See
      10             : // Contributors.txt for a full list of contributors. Created, in part, with
      11             : // funding and support from the U.S. Government (see Acknowledgments.txt file).
      12             : // DM22-0790
      13             : 
      14             : // Contributed by Timothy A. Davis, Texas A&M University
      15             : 
      16             : //------------------------------------------------------------------------------
      17             : 
      18             : #include "LG_internal.h"
      19             : 
      20             : // returns true if A [a] < B [b]
      21             : #define LG_lt(A,a,B,b)                  \
      22             :     LG_lt_1 (A ## _0, a, B ## _0, b)
      23             : 
      24             : // argument list for calling a function
      25             : #define LG_arg(A)                       \
      26             :     A ## _0
      27             : 
      28             : // argument list for calling a function, with offset
      29             : #define LG_arg_offset(A,x)              \
      30             :     A ## _0 + (x)
      31             : 
      32             : // argument list for defining a function
      33             : #define LG_args(A)                      \
      34             :     int64_t *LG_RESTRICT A ## _0
      35             : 
      36             : // each entry has a single key
      37             : #define LG_K 1
      38             : 
      39             : // swap A [a] and A [b]
      40             : #define LG_swap(A,a,b)                                                        \
      41             : {                                                                             \
      42             :     int64_t t0 = A ## _0 [a] ; A ## _0 [a] = A ## _0 [b] ; A ## _0 [b] = t0 ; \
      43             : }
      44             : 
      45             : #define LG_partition LG_partition_1a
      46             : #define LG_quicksort LG_quicksort_1a
      47             : 
      48             : #include "LG_qsort_template.h"
      49             : 
      50         254 : void LG_qsort_1a    // sort array A of size 1-by-n
      51             : (
      52             :     int64_t *LG_RESTRICT A_0,       // size n array
      53             :     const int64_t n
      54             : )
      55             : {
      56         254 :     uint64_t seed = n ;
      57         254 :     LG_quicksort (LG_arg (A), n, &seed, NULL) ;
      58         254 : }

Generated by: LCOV version 1.14