strop 0.3.0

stochastically generates machine code
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! This module has a few objective functions in it which you might want to optimize for

use crate::Objective;
use crate::Sequence;

/// Objective function for optimizing for size
#[derive(Debug, Default)]
pub struct Short;

impl<I> Objective<Sequence<I>> for Short
where
    I: crate::Encode<u8>,
{
    fn score(&self, instruction_sequence: &Sequence<I>) -> f64 {
        use crate::Encode;
        instruction_sequence.encode().len() as f64
    }
}