projects
/
c11tester.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bug fixes
[c11tester.git]
/
actionlist.cc
diff --git
a/actionlist.cc
b/actionlist.cc
index f859746ccf5e5bac1c5148c420829946dee6fb0f..9f335e900e2de1910bf7e1a75531b04a64cb56a7 100644
(file)
--- a/
actionlist.cc
+++ b/
actionlist.cc
@@
-5,8
+5,11
@@
#include <limits.h>
actionlist::actionlist() :
#include <limits.h>
actionlist::actionlist() :
- _size(0)
+ head(NULL),
+ tail(NULL),
+ _size(0)
{
{
+ root.parent = NULL;
}
actionlist::~actionlist() {
}
actionlist::~actionlist() {
@@
-44,9
+47,10
@@
sllnode<ModelAction *> * allnode::findPrev(modelclock_t index) {
continue;
} else {
//found non-null...
continue;
} else {
//found non-null...
- if (totalshift
!
= 0)
-
ptr = ptr->children[currindex]
;
+ if (totalshift
=
= 0)
+
return reinterpret_cast<sllnode<ModelAction *> *>(((uintptr_t)ptr->children[currindex])& ACTMASK)
;
//need to increment here...
//need to increment here...
+ ptr = ptr->children[currindex];
increment = increment >> ALLBITS;
mask = mask >> ALLBITS;
totalshift -= ALLBITS;
increment = increment >> ALLBITS;
mask = mask >> ALLBITS;
totalshift -= ALLBITS;
@@
-59,7
+63,7
@@
sllnode<ModelAction *> * allnode::findPrev(modelclock_t index) {
mask = mask << ALLBITS;
totalshift += ALLBITS;
mask = mask << ALLBITS;
totalshift += ALLBITS;
- if (
increment == 0
) {
+ if (
ptr == NULL
) {
return NULL;
}
}
return NULL;
}
}
@@
-71,9
+75,10
@@
sllnode<ModelAction *> * allnode::findPrev(modelclock_t index) {
if (ptr->children[currindex] != NULL) {
if (totalshift != 0) {
ptr = ptr->children[currindex];
if (ptr->children[currindex] != NULL) {
if (totalshift != 0) {
ptr = ptr->children[currindex];
+ break;
} else {
allnode * act = ptr->children[currindex];
} else {
allnode * act = ptr->children[currindex];
- sllnode<ModelAction *> * node = reinterpret_cast<sllnode<ModelAction *>*>(((uintptr_t)act) & A
LL
MASK);
+ sllnode<ModelAction *> * node = reinterpret_cast<sllnode<ModelAction *>*>(((uintptr_t)act) & A
CT
MASK);
return node;
}
}
return node;
}
}
@@
-100,7
+105,7
@@
void actionlist::addAction(ModelAction * act) {
llnode->val = act;
if (tmp == NULL) {
ptr->children[index] = reinterpret_cast<allnode *>(((uintptr_t) llnode) | ISACT);
llnode->val = act;
if (tmp == NULL) {
ptr->children[index] = reinterpret_cast<allnode *>(((uintptr_t) llnode) | ISACT);
- sllnode<ModelAction *> * llnodeprev = ptr->findPrev(
index
);
+ sllnode<ModelAction *> * llnodeprev = ptr->findPrev(
clock
);
if (llnodeprev != NULL) {
llnode->next = llnodeprev->next;
if (llnodeprev != NULL) {
llnode->next = llnodeprev->next;
@@
-131,10
+136,11
@@
void actionlist::addAction(ModelAction * act) {
} else {
//handle case where something else is here
} else {
//handle case where something else is here
- sllnode<ModelAction *> * llnodeprev = reinterpret_cast<sllnode<ModelAction *>*>(((uintptr_t) llnode) & A
LL
MASK);
+ sllnode<ModelAction *> * llnodeprev = reinterpret_cast<sllnode<ModelAction *>*>(((uintptr_t) llnode) & A
CT
MASK);
llnode->next = llnodeprev->next;
llnode->prev = llnodeprev;
llnode->next = llnodeprev->next;
llnode->prev = llnodeprev;
- llnode->next->prev = llnode;
+ if (llnode->next != NULL)
+ llnode->next->prev = llnode;
llnodeprev->next = llnode;
ptr->children[index] = reinterpret_cast<allnode *>(((uintptr_t) llnode) | ISACT);
}
llnodeprev->next = llnode;
ptr->children[index] = reinterpret_cast<allnode *>(((uintptr_t) llnode) | ISACT);
}
@@
-178,7
+184,7
@@
void actionlist::removeAction(ModelAction * act) {
//not found
return;
} else {
//not found
return;
} else {
- sllnode<ModelAction *> * llnode = reinterpret_cast<sllnode<ModelAction *> *>(((uintptr_t) tmp) & A
LL
MASK);
+ sllnode<ModelAction *> * llnode = reinterpret_cast<sllnode<ModelAction *> *>(((uintptr_t) tmp) & A
CT
MASK);
bool first = true;
do {
if (llnode->val == act) {
bool first = true;
do {
if (llnode->val == act) {