Fix Loop Exit Bug
[satcheck.git] / epvalue.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 "epvalue.h"
11 #include "execpoint.h"
12 #include "mcutil.h"
13
14 EPValue::EPValue(ExecPoint * ep, EPRecord * epr, const void * _addr, uint64_t ivalue, int ilen) :
15         firstrecord(NULL),
16         lastrecord(NULL),
17         execpoint(ep),
18         record(epr),
19         addr(_addr),
20         value(keepbytes(ivalue, ilen)),
21         len(ilen)
22 {
23 }
24
25 EPValue::~EPValue() {
26 }
27
28 bool EPValueEquals(EPValue * ep1, EPValue *ep2) {
29         if (ep1 == NULL)
30                 return ep2 == NULL;
31
32         if (ep1->addr != ep2->addr || ep1->len!=ep2->len || ep1->value!=ep2->value)
33                 return false;
34         return ExecPointEquals(ep1->execpoint, ep2->execpoint);
35 }
36
37 unsigned int EPValueHash(EPValue *ep) {
38         return ExecPointHash(ep->execpoint) ^ ep->len ^ ep->value ^ ((intptr_t)ep->addr);
39 }