Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
3f8322be
Commit
3f8322be
authored
Feb 27, 2012
by
Ian Barber
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #268 from gimaker/compact-trie-table
Fixed a bug in the mtrie table compaction logic.
parents
7689d205
3485b3ef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
mtrie.cpp
src/mtrie.cpp
+12
-5
No files found.
src/mtrie.cpp
View file @
3f8322be
...
...
@@ -200,16 +200,16 @@ void zmq::mtrie_t::rm_helper (pipe_t *pipe_, unsigned char **buff_,
// If there are multiple subnodes.
//
// New min non-null character in the node table after the removal
unsigned
char
new_min
=
min
;
unsigned
char
new_min
=
min
+
count
-
1
;
// New max non-null character in the node table after the removal
unsigned
char
new_max
=
min
+
count
-
1
;
unsigned
char
new_max
=
min
;
for
(
unsigned
short
c
=
0
;
c
!=
count
;
c
++
)
{
(
*
buff_
)
[
buffsize_
]
=
min
+
c
;
if
(
next
.
table
[
c
])
{
next
.
table
[
c
]
->
rm_helper
(
pipe_
,
buff_
,
buffsize_
+
1
,
maxbuffsize_
,
func_
,
arg_
);
// Prune redudant nodes from the mtrie
// Prune redu
n
dant nodes from the mtrie
if
(
next
.
table
[
c
]
->
is_redundant
())
{
delete
next
.
table
[
c
];
next
.
table
[
c
]
=
0
;
...
...
@@ -218,9 +218,16 @@ void zmq::mtrie_t::rm_helper (pipe_t *pipe_, unsigned char **buff_,
--
live_nodes
;
}
else
{
if
(
c
+
min
>
new_min
)
// The node is not redundant, so it's a candidate for being
// the new min/max node.
//
// We loop through the node array from left to right, so the
// first non-null, non-redundant node encountered is the new
// minimum index. Conversely, the last non-redundant, non-null
// node encountered is the new maximum index.
if
(
c
+
min
<
new_min
)
new_min
=
c
+
min
;
if
(
c
+
min
<
new_max
)
if
(
c
+
min
>
new_max
)
new_max
=
c
+
min
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment