Skip to content

Commit aacc359

Browse files
Merge #264
264: Add support for AVR. r=japaric a=jeremysalwen In order to support AVR, the following changes were made: - AVR was added to the list of architectures not supporting atomics or cas. - AVR was configured to not use AtomicUsize, similarly to armv6m. - SortedLinkedList was modified to account for the fact that usize is differently sized on different architectures (16 bits on AVR). Co-authored-by: Jeremy Salwen <[email protected]>
2 parents 705f93b + 8aa68d7 commit aacc359

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
88
## [Unreleased]
99

1010
### Added
11+
- Added support for AVR architecture.
1112

1213
* Add Entry Api to IndexMap
1314
* Implement IntoIterator trait for Indexmap

src/sorted_linked_list.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ where
9595

9696
// Internal macro for generating indexes for the linkedlist and const new for the linked list
9797
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) => {
9999
/// Index for the [`SortedLinkedList`] with specific backing storage.
100100
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
101101
pub struct $name($ty);
@@ -178,9 +178,9 @@ macro_rules! impl_index_and_const_new {
178178
};
179179
}
180180

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 });
184184

185185
impl<T, Idx, K, const N: usize> SortedLinkedList<T, Idx, K, N>
186186
where

0 commit comments

Comments
 (0)