Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
903752f4
Commit
903752f4
authored
Jan 27, 2012
by
Ivan Krasin
Committed by
Robert Griesemer
Jan 27, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compress/flate: remove unused huffmanEncoder.generateChains.
R=rsc, gri CC=golang-dev
https://golang.org/cl/5577061
parent
b79ba6a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
55 deletions
+0
-55
src/pkg/compress/flate/huffman_code.go
src/pkg/compress/flate/huffman_code.go
+0
-55
No files found.
src/pkg/compress/flate/huffman_code.go
View file @
903752f4
...
@@ -121,61 +121,6 @@ func (h *huffmanEncoder) bitLength(freq []int32) int64 {
...
@@ -121,61 +121,6 @@ func (h *huffmanEncoder) bitLength(freq []int32) int64 {
return
total
return
total
}
}
// Generate elements in the chain using an iterative algorithm.
func
(
h
*
huffmanEncoder
)
generateChains
(
top
*
levelInfo
,
list
[]
literalNode
)
{
n
:=
len
(
list
)
list
=
list
[
0
:
n
+
1
]
list
[
n
]
=
maxNode
()
l
:=
top
for
{
if
l
.
nextPairFreq
==
math
.
MaxInt32
&&
l
.
nextCharFreq
==
math
.
MaxInt32
{
// We've run out of both leafs and pairs.
// End all calculations for this level.
// To m sure we never come back to this level or any lower level,
// set nextPairFreq impossibly large.
l
.
lastChain
=
nil
l
.
needed
=
0
l
=
l
.
up
l
.
nextPairFreq
=
math
.
MaxInt32
continue
}
prevFreq
:=
l
.
lastChain
.
freq
if
l
.
nextCharFreq
<
l
.
nextPairFreq
{
// The next item on this row is a leaf node.
n
:=
l
.
lastChain
.
leafCount
+
1
l
.
lastChain
=
&
chain
{
l
.
nextCharFreq
,
n
,
l
.
lastChain
.
up
}
l
.
nextCharFreq
=
list
[
n
]
.
freq
}
else
{
// The next item on this row is a pair from the previous row.
// nextPairFreq isn't valid until we generate two
// more values in the level below
l
.
lastChain
=
&
chain
{
l
.
nextPairFreq
,
l
.
lastChain
.
leafCount
,
l
.
down
.
lastChain
}
l
.
down
.
needed
=
2
}
if
l
.
needed
--
;
l
.
needed
==
0
{
// We've done everything we need to do for this level.
// Continue calculating one level up. Fill in nextPairFreq
// of that level with the sum of the two nodes we've just calculated on
// this level.
up
:=
l
.
up
if
up
==
nil
{
// All done!
return
}
up
.
nextPairFreq
=
prevFreq
+
l
.
lastChain
.
freq
l
=
up
}
else
{
// If we stole from below, move down temporarily to replenish it.
for
l
.
down
.
needed
>
0
{
l
=
l
.
down
}
}
}
}
// Return the number of literals assigned to each bit size in the Huffman encoding
// Return the number of literals assigned to each bit size in the Huffman encoding
//
//
// This method is only called when list.length >= 3
// This method is only called when list.length >= 3
...
...
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