about summary refs log tree commit diff
path: root/library/stdarch/crates/intrinsic-test/src/common/constraint.rs
blob: 269fb7f90cb7ee7db82d074e2bd9165c3bc13692 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use serde::Deserialize;
use std::ops::Range;

#[derive(Debug, PartialEq, Clone, Deserialize)]
pub enum Constraint {
    Equal(i64),
    Range(Range<i64>),
}

impl Constraint {
    pub fn to_range(&self) -> Range<i64> {
        match self {
            Constraint::Equal(eq) => *eq..*eq + 1,
            Constraint::Range(range) => range.clone(),
        }
    }
}