projects
/
c11tester.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
14e0cf7
)
hashtable: style
author
Brian Norris
<banorris@uci.edu>
Fri, 4 Jan 2013 01:01:09 +0000
(17:01 -0800)
committer
Brian Norris
<banorris@uci.edu>
Fri, 4 Jan 2013 01:21:02 +0000
(17:21 -0800)
hashtable.h
patch
|
blob
|
history
diff --git
a/hashtable.h
b/hashtable.h
index 016d4925215c7158f0dc7267d5c2a6136668850e..a15265bafbe7f1b7658c4ddbcb8bcb8b6175a124 100644
(file)
--- a/
hashtable.h
+++ b/
hashtable.h
@@
-109,7
+109,7
@@
template<typename _Key, typename _Val, typename _KeyInt, int _Shift = 0, void *
unsigned int index = ((_KeyInt)key) >> _Shift;
do {
unsigned int index = ((_KeyInt)key) >> _Shift;
do {
- index
= index &
capacitymask;
+ index
&=
capacitymask;
search = &table[index];
if (search->key == key) {
search->val = val;
search = &table[index];
if (search->key == key) {
search->val = val;
@@
-129,11
+129,10
@@
template<typename _Key, typename _Val, typename _KeyInt, int _Shift = 0, void *
unsigned int index = ((_KeyInt)key) >> _Shift;
do {
unsigned int index = ((_KeyInt)key) >> _Shift;
do {
- index
= index&
capacitymask;
+ index
&=
capacitymask;
search = &table[index];
search = &table[index];
- if (search->key == key)
{
+ if (search->key == key)
return search->val;
return search->val;
- }
index++;
} while (search->key);
return (_Val) 0;
index++;
} while (search->key);
return (_Val) 0;
@@
-145,11
+144,10
@@
template<typename _Key, typename _Val, typename _KeyInt, int _Shift = 0, void *
unsigned int index = ((_KeyInt)key) >> _Shift;
do {
unsigned int index = ((_KeyInt)key) >> _Shift;
do {
- index
= index &
capacitymask;
+ index
&=
capacitymask;
search = &table[index];
search = &table[index];
- if (search->key == key)
{
+ if (search->key == key)
return true;
return true;
- }
index++;
} while (search->key);
return false;
index++;
} while (search->key);
return false;
@@
-162,8
+160,8
@@
template<typename _Key, typename _Val, typename _KeyInt, int _Shift = 0, void *
unsigned int oldcapacity = capacity;
if ((newtable = (struct hashlistnode<_Key, _Val> *) _calloc(newsize, sizeof(struct hashlistnode<_Key, _Val>))) == NULL) {
unsigned int oldcapacity = capacity;
if ((newtable = (struct hashlistnode<_Key, _Val> *) _calloc(newsize, sizeof(struct hashlistnode<_Key, _Val>))) == NULL) {
- model_print("
C
alloc error %s %d\n", __FILE__, __LINE__);
- exit(
-1
);
+ model_print("
c
alloc error %s %d\n", __FILE__, __LINE__);
+ exit(
EXIT_FAILURE
);
}
table = newtable; //Update the global hashtable upon resize()
}
table = newtable; //Update the global hashtable upon resize()
@@
-181,7
+179,7
@@
template<typename _Key, typename _Val, typename _KeyInt, int _Shift = 0, void *
unsigned int index = ((_KeyInt)key) >> _Shift;
do {
unsigned int index = ((_KeyInt)key) >> _Shift;
do {
- index
= index &
capacitymask;
+ index
&=
capacitymask;
search = &table[index];
index++;
} while (search->key);
search = &table[index];
index++;
} while (search->key);