feat(auxflash): Slot, SlotOffset wrappers#2296
feat(auxflash): Slot, SlotOffset wrappers#2296aapoalas wants to merge 5 commits intooxidecomputer:masterfrom
Conversation
0881390 to
4649a71
Compare
| let pos = inner_offset | ||
| - inner_chunk.header().total_len_in_bytes() as u64 | ||
| + core::mem::size_of::<tlvc::ChunkHeader>() as u64; | ||
| let pos = u32::try_from(inner_chunk.body_position()) |
There was a problem hiding this comment.
note: I was looking at the original code here and became convinced that this just wants the body_position from inner_chunk. There's still a chance I'm wrong, I didn't drag a comb through the code to really, truly convince myself of it but definitely the inner_offset is the position of the next chunk, and offsetting that by the total size - header size should give us the previous chunk's body position.
It seems prudent to just add an API to expose that location to tlvc; I have added that API to the PR that I have open in tlvc.
| // How much space is in the FIFO? | ||
| let fl = usize::from(sr.flevel().bits()); | ||
| let ffree = FIFO_SIZE - fl; | ||
| let ffree = FIFO_SIZE.saturating_sub(fl); |
There was a problem hiding this comment.
note: Easy panic path here to remove; saturating arithmetic is what we know this comes out to, so it's an easy choice. Equally well it would be fine to make this unchecked.
c57013d to
5c91f3f
Compare
No description provided.