Skip to content

Commit 8aa68d7

Browse files
committed
Add support for AVR.
In order to support AVR, the following changes were made: - AVR was added to the list of architectures supported by atomic-polyfill. - SortedLinkedList was modified to account for the fact that usize is differently sized on different architectures (16 bits on AVR).
1 parent 3b2bc42 commit 8aa68d7

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
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1010
### Fixed
1111

1212
### Added
13+
- Added support for AVR architecture.
1314

1415
### Changed
1516

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)