Skip to content

Commit 803e806

Browse files
Use the len() function from the input
1 parent 758266f commit 803e806

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
#![no_std]
22
#![feature(const_fn, const_if_match, const_loop)]
33

4-
/// This macro takes the following parameters in the order they're listed:
5-
/// type to sort, index to start at, index to end at, total array length, and name of existing
6-
/// const / static array variable (or directly-passed "anonymous" array).
4+
/// This macro takes the following parameters in the order they're listed: type to sort, index to
5+
/// start at, index to end at, and either the name of an existing `const` or `static` array variable
6+
/// or just a directly-passed "anonymous" array.
77
#[macro_export]
88
macro_rules! staticsort {
9-
($type:ty, $low:expr, $high:expr, $len:expr, $values:expr) => {{
10-
match $len {
9+
($type:ty, $low:expr, $high:expr, $values:expr) => {{
10+
match $values.len() {
1111
0 => $values,
1212
_ => {
1313
#[inline]
1414
const fn static_sort(
15-
mut values: [$type; $len],
15+
mut values: [$type; $values.len()],
1616
mut low: isize,
1717
mut high: isize,
18-
) -> [$type; $len]
18+
) -> [$type; $values.len()]
1919
{
2020
if high - low <= 0 {
2121
return values;

0 commit comments

Comments
 (0)