Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
troydhanson committed Aug 14, 2015
1 parent 9c01dd0 commit 7ff53fb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion huffman/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ OBJS=huff.o code.o
all: $(PROGS)

#CFLAGS += -g
CFLAGS += -O2
CFLAGS += -O2 -DNDEBUG
CFLAGS += -Wall

$(OBJS): %.o: %.c code.h
Expand Down
2 changes: 1 addition & 1 deletion lzw/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ OBJS=lzw.o code.o
all: $(PROGS)

#CFLAGS += -g
CFLAGS += -O2
CFLAGS += -O2 -DNDEBUG
CFLAGS += -Wall

$(OBJS): %.o: %.c code.h
Expand Down
15 changes: 15 additions & 0 deletions lzw/code.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,21 @@ size_t add_seq(symbol_stats *s, unsigned char *seq, size_t len) {
return 0;
}

int lookup_seq(symbol_stats *s, unsigned char *seq, size_t len, size_t *index) {
struct seq *q;
int rc = -1;

HASH_FIND(hh, s->dict, seq, len, q);
if (q == NULL) goto done;

*index = q - s->seq_all;
q->hits++;
rc = 0;

done:
return rc;
}

/*
*
*/
Expand Down

0 comments on commit 7ff53fb

Please sign in to comment.