Unusual conflict, no apparent commits from another machine. Resolved formatting. Using HEAD.
This commit is contained in:
commit
d45e9bd270
1 changed files with 6 additions and 28 deletions
34
src/map.rs
34
src/map.rs
|
|
@ -263,34 +263,12 @@ impl<E: TableEntry> DisplacementSet<E> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn get<K>(&mut self, index: K) -> Option<&E>
|
}
|
||||||
where
|
pub fn new() -> DisplacementSet<E> {
|
||||||
E: Equivalent<K>,
|
DisplacementSet {
|
||||||
K: Hashes,
|
map: Vec::new(),
|
||||||
{
|
map_count: 0,
|
||||||
if self.map.len() == 0 {
|
map_bounds: (0..0).into(),
|
||||||
return None;
|
|
||||||
}
|
|
||||||
let location = index.hashed() as usize % self.map.len();
|
|
||||||
let home = &self.map[location];
|
|
||||||
if home.entry.matches(&index) {
|
|
||||||
Some(&home.entry)
|
|
||||||
} else {
|
|
||||||
for i in 1..home.displacement as usize {
|
|
||||||
let neighbour = &self.map[(location + i) % self.map.len()];
|
|
||||||
if neighbour.entry.matches(&index) {
|
|
||||||
return Some(&neighbour.entry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pub fn new() -> DisplacementSet<E> {
|
|
||||||
DisplacementSet {
|
|
||||||
map: Vec::new(),
|
|
||||||
map_count: 0,
|
|
||||||
map_bounds: (0..0).into(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue