implement get_rank_set_mark natively

This commit is contained in:
Folkert 2022-05-20 22:54:51 +02:00
parent afedc4ab01
commit a99489fb57
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
2 changed files with 11 additions and 5 deletions

View file

@ -1716,11 +1716,7 @@ impl Subs {
#[inline(always)] #[inline(always)]
pub fn get_rank_set_mark(&mut self, key: Variable, mark: Mark) -> Rank { pub fn get_rank_set_mark(&mut self, key: Variable, mark: Mark) -> Rank {
// let l_key = self.utable.inlined_get_root_key(key); self.utable.get_rank_set_mark(key, mark)
self.utable.set_mark(key, mark);
self.utable.get_rank(key)
} }
pub fn equivalent(&mut self, left: Variable, right: Variable) -> bool { pub fn equivalent(&mut self, left: Variable, right: Variable) -> bool {

View file

@ -200,6 +200,16 @@ impl UnificationTable {
self.root_key(a) == self.root_key(b) self.root_key(a) == self.root_key(b)
} }
// custom very specific helpers
#[inline(always)]
pub fn get_rank_set_mark(&mut self, key: Variable, mark: Mark) -> Rank {
let index = self.root_key(key).index() as usize;
self.marks[index] = mark;
self.ranks[index]
}
// TODO remove // TODO remove
#[inline(always)] #[inline(always)]
pub fn inlined_get_root_key(&mut self, key: Variable) -> Variable { pub fn inlined_get_root_key(&mut self, key: Variable) -> Variable {