|
95 | 95 |
|
96 | 96 | // Internal macro for generating indexes for the linkedlist and const new for the linked list
|
97 | 97 | macro_rules! impl_index_and_const_new {
|
98 |
| - ($name:ident, $ty:ty, $new_name:ident, $max_val:literal) => { |
| 98 | + ($name:ident, $ty:ty, $new_name:ident, $max_val:expr) => { |
99 | 99 | /// Index for the [`SortedLinkedList`] with specific backing storage.
|
100 | 100 | #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
101 | 101 | pub struct $name($ty);
|
@@ -178,9 +178,9 @@ macro_rules! impl_index_and_const_new {
|
178 | 178 | };
|
179 | 179 | }
|
180 | 180 |
|
181 |
| -impl_index_and_const_new!(LinkedIndexU8, u8, new_u8, 254); // val is 2^8 - 2 (one less than max) |
182 |
| -impl_index_and_const_new!(LinkedIndexU16, u16, new_u16, 65_534); // val is 2^16 - 2 |
183 |
| -impl_index_and_const_new!(LinkedIndexUsize, usize, new_usize, 4_294_967_294); // val is 2^32 - 2 |
| 181 | +impl_index_and_const_new!(LinkedIndexU8, u8, new_u8, { u8::MAX as usize - 1 }); |
| 182 | +impl_index_and_const_new!(LinkedIndexU16, u16, new_u16, { u16::MAX as usize - 1 }); |
| 183 | +impl_index_and_const_new!(LinkedIndexUsize, usize, new_usize, { usize::MAX - 1 }); |
184 | 184 |
|
185 | 185 | impl<T, Idx, K, const N: usize> SortedLinkedList<T, Idx, K, N>
|
186 | 186 | where
|
|
0 commit comments