mirror of
https://github.com/italicsjenga/rp-hal-boards.git
synced 2025-01-23 01:36:35 +11:00
do not include offset when checking wrap bounds
This commit is contained in:
parent
1ba07b09e7
commit
3c06a3359e
1 changed files with 1 additions and 1 deletions
|
@ -303,7 +303,7 @@ impl<P: PIOExt> InstalledProgram<P> {
|
||||||
/// * [`Err`] containing the old program if the provided wrap was invalid (outside the bounds of
|
/// * [`Err`] containing the old program if the provided wrap was invalid (outside the bounds of
|
||||||
/// the program length)
|
/// the program length)
|
||||||
pub fn set_wrap(self, wrap: Wrap) -> Result<Self, Self> {
|
pub fn set_wrap(self, wrap: Wrap) -> Result<Self, Self> {
|
||||||
if (self.offset + wrap.source) < self.length && (self.offset + wrap.target) < self.length {
|
if wrap.source < self.length && wrap.target < self.length {
|
||||||
Ok(InstalledProgram { wrap, ..self })
|
Ok(InstalledProgram { wrap, ..self })
|
||||||
} else {
|
} else {
|
||||||
Err(self)
|
Err(self)
|
||||||
|
|
Loading…
Add table
Reference in a new issue