3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-27 19:05:51 +00:00

debug model evaluator

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2018-06-15 14:58:02 -07:00
parent e94b97376c
commit a51d6cbcbc
4 changed files with 27 additions and 20 deletions

View file

@ -326,29 +326,29 @@ namespace datalog {
public:
unsigned m_offset; //!< in bits
unsigned m_length; //!< in bits
column_info(unsigned offset, unsigned length) \
: m_big_offset(offset/8),
m_small_offset(offset%8),
m_mask( length==64 ? ULLONG_MAX : (static_cast<uint64_t>(1)<<length)-1 ),
m_write_mask( ~(m_mask<<m_small_offset) ),
m_offset(offset),
m_length(length) {
SASSERT(length<=64);
SASSERT(length+m_small_offset<=64);
column_info(unsigned offset, unsigned length)
: m_big_offset(offset / 8),
m_small_offset(offset % 8),
m_mask( length == 64 ? ULLONG_MAX : (static_cast<uint64_t>(1)<<length)-1 ),
m_write_mask( ~(m_mask << m_small_offset) ),
m_offset(offset),
m_length(length) {
SASSERT(length <= 64);
SASSERT(length + m_small_offset <= 64);
}
table_element get(const char * rec) const {
const uint64_t * ptr = reinterpret_cast<const uint64_t*>(rec+m_big_offset);
const uint64_t * ptr = reinterpret_cast<const uint64_t*>(rec + m_big_offset);
uint64_t res = *ptr;
res>>=m_small_offset;
res&=m_mask;
res >>= m_small_offset;
res &= m_mask;
return res;
}
void set(char * rec, table_element val) const {
SASSERT( (val&~m_mask)==0 ); //the value fits into the column
uint64_t * ptr = reinterpret_cast<uint64_t*>(rec+m_big_offset);
*ptr&=m_write_mask;
*ptr|=val<<m_small_offset;
uint64_t * ptr = reinterpret_cast<uint64_t*>(rec + m_big_offset);
*ptr &= m_write_mask;
*ptr |= val << m_small_offset;
}
unsigned next_ofs() const { return m_offset+m_length; }
};