Skip to content

Commit

Permalink
Fix running rake huffman:generate_table. (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
froydnj authored Jun 27, 2024
1 parent dcf0674 commit 77034ea
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tasks/huffman.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
# Copyright, 2016, by George Ulmer.
# Copyright, 2018-2024, by Samuel Williams.

require_relative '../lib/http/hpack/huffman'
require_relative '../lib/protocol/hpack/huffman'

require 'set'

module Huffman
BITS_AT_ONCE = HTTP::HPACK::Huffman::BITS_AT_ONCE
BITS_AT_ONCE = Protocol::HPACK::Huffman::BITS_AT_ONCE
EOS = 256

class Node
Expand Down Expand Up @@ -49,7 +49,7 @@ def initialize(emit, node)

def self.generate_tree
@root = new(0)
HTTP::HPACK::Huffman::CODES.each_with_index do |c, chr|
Protocol::HPACK::Huffman::CODES.each_with_index do |c, chr|
code, len = c
@root.add(code, len, chr)
end
Expand All @@ -71,7 +71,7 @@ def self.generate_machine

(1 << BITS_AT_ONCE).times do |input|
n = node
emit = ''
emit = +''
(BITS_AT_ONCE - 1).downto(0) do |i|
bit = (input & (1 << i)).zero? ? 0 : 1
n = n.next[bit]
Expand Down Expand Up @@ -107,7 +107,7 @@ def self.generate_state_table
id += 1
end

File.open(File.expand_path('../lib/http/hpack/huffman/machine.rb', File.dirname(__FILE__)), 'w') do |f|
File.open(File.expand_path('../lib/protocol/hpack/huffman/machine.rb', File.dirname(__FILE__)), 'w') do |f|
f.print <<HEADER
# frozen_string_literal: true
Expand Down

0 comments on commit 77034ea

Please sign in to comment.