Fix Loop Exit Bug
[satcheck.git] / change.cc
1 /*      Copyright (c) 2015 Regents of the University of California
2  *
3  *      Author: Brian Demsky <bdemsky@uci.edu>
4  *
5  *      This program is free software; you can redistribute it and/or
6  *      modify it under the terms of the GNU General Public License
7  *      version 2 as published by the Free Software Foundation.
8  */
9
10 #include "change.h"
11
12 MCChange::MCChange(EPRecord * _record, uint64_t _val, unsigned int _index) :
13         record(_record),
14         val(_val),
15         index(_index)
16 {
17         ASSERT(record->getType()!=BRANCHDIR);
18 }
19
20 MCChange::~MCChange() {
21 }
22
23 void MCChange::print() {
24         record->print();
25         model_print("(");
26         model_print("index=%u, val=%lu)\n", index, val);
27 }
28
29 bool MCChangeEquals(MCChange *mcc1, MCChange *mcc2) {
30         if (mcc1==NULL)
31                 return mcc1==mcc2;
32         return (mcc1->record==mcc2->record) && (mcc1->val==mcc2->val) && (mcc1->index == mcc2->index);
33 }
34
35 unsigned int MCChangeHash(MCChange *mcc) {
36         return ((unsigned int)((uintptr_t)mcc->record))^((unsigned int)mcc->val)^mcc->index;
37 }
38