I2SRandReplace mutator
This commit is contained in:
parent
8437c4adb7
commit
ae5b4f88cc
@ -15,9 +15,10 @@ use std::{
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
bolts::rands::Rand,
|
bolts::rands::Rand,
|
||||||
|
feedbacks::cmp::CmpValuesMetadata,
|
||||||
inputs::{HasBytesVec, Input},
|
inputs::{HasBytesVec, Input},
|
||||||
mutators::{buffer_self_copy, mutations::buffer_copy, MutationResult, Mutator, Named},
|
mutators::{buffer_self_copy, mutations::buffer_copy, MutationResult, Mutator, Named},
|
||||||
observers::cmp::{CmpValues, CmpValuesMetadata},
|
observers::cmp::CmpValues,
|
||||||
state::{HasMaxSize, HasMetadata, HasRand},
|
state::{HasMaxSize, HasMetadata, HasRand},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
@ -310,7 +311,6 @@ where
|
|||||||
S: HasMetadata + HasRand<R> + HasMaxSize,
|
S: HasMetadata + HasRand<R> + HasMaxSize,
|
||||||
R: Rand,
|
R: Rand,
|
||||||
{
|
{
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
fn mutate(
|
fn mutate(
|
||||||
&mut self,
|
&mut self,
|
||||||
state: &mut S,
|
state: &mut S,
|
||||||
@ -344,13 +344,13 @@ where
|
|||||||
let mut result = MutationResult::Skipped;
|
let mut result = MutationResult::Skipped;
|
||||||
match cmp_values {
|
match cmp_values {
|
||||||
CmpValues::U8(v) => {
|
CmpValues::U8(v) => {
|
||||||
for byte in bytes.iter_mut().take(len).skip(off) {
|
for i in off..len {
|
||||||
if *byte == v.0 {
|
if bytes[i] == v.0 {
|
||||||
*byte = v.1;
|
bytes[i] = v.1;
|
||||||
result = MutationResult::Mutated;
|
result = MutationResult::Mutated;
|
||||||
break;
|
break;
|
||||||
} else if *byte == v.1 {
|
} else if bytes[i] == v.1 {
|
||||||
*byte = v.0;
|
bytes[i] = v.0;
|
||||||
result = MutationResult::Mutated;
|
result = MutationResult::Mutated;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -449,8 +449,6 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//println!("{:?}", result);
|
|
||||||
|
|
||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user