Skip to content

Commit 0a7f84f

Browse files
committed
Use platform dependent constants in atoms trie
Use 62 bits per atom id on 64bit platform and 30 bits per atom id on 32bits platform.
1 parent c2c7d2a commit 0a7f84f

File tree

1 file changed

+10
-8
lines changed
  • lib/src/space/grounding/index

1 file changed

+10
-8
lines changed

lib/src/space/grounding/index/trie.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -485,14 +485,16 @@ enum AtomMatchMode {
485485
Unification,
486486
}
487487

488-
const TK_STORE_MASK: usize = 0b1 << 63;
489-
const TK_MATCH_MASK: usize = 0b1 << 62;
490-
const TK_VALUE_MASK: usize = !(0b11 << 62);
491-
492-
const TK_STORE_HASH: usize = 0b0 << 63;
493-
const TK_STORE_INDEX: usize = 0b1 << 63;
494-
const TK_MATCH_EXACT: usize = 0b0 << 62;
495-
const TK_MATCH_CUSTOM: usize = 0b1 << 62;
488+
const BITS_PER_ID: u32 = usize::BITS - 2;
489+
490+
const TK_STORE_MASK: usize = 0b10 << BITS_PER_ID;
491+
const TK_MATCH_MASK: usize = 0b01 << BITS_PER_ID;
492+
const TK_VALUE_MASK: usize = !(0b11 << BITS_PER_ID);
493+
494+
const TK_STORE_HASH: usize = 0b00 << BITS_PER_ID;
495+
const TK_STORE_INDEX: usize = 0b10 << BITS_PER_ID;
496+
const TK_MATCH_EXACT: usize = 0b00 << BITS_PER_ID;
497+
const TK_MATCH_CUSTOM: usize = 0b01 << BITS_PER_ID;
496498

497499
/// Compact representation of the atom from the trie. It represents each
498500
/// atom using single [usize] value. It keeps value of the key, key matching

0 commit comments

Comments
 (0)