Skip to content

Commit

Permalink
some tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
cathugger committed May 23, 2020
1 parent a3e141e commit d5b90d4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 7 additions & 1 deletion GNUmakefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,18 @@ TEST_EXE= $(patsubst %,%@EXEEXT@,$(TEST_TGT))

ALL_EXE= $(MAIN_EXE) $(UTIL_EXE) $(TEST_EXE)

.PHONY: default all clean distclean depend
.PHONY: default all main util test clean distclean depend

default: $(MAIN_EXE)

all: $(ALL_EXE)

main: $(MAIN_EXE)

util: $(UTIL_EXE)

test: $(TEST_EXE)

mkp224o@EXEEXT@: $(MAIN_OBJ)
$(CC) $(LDFLAGS) $(CFLAGS) -o [email protected] $^ $(MAIN_LIB) && $(MV) [email protected] $@

Expand Down
9 changes: 5 additions & 4 deletions calcest.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <stdio.h>
#include <stddef.h>
#include <math.h>

/*
Expand All @@ -19,20 +20,20 @@ const int charcounts[] = { 2, 3, 4, 5, 6, 7 };
int main(void)
{
printf(" |");
for (int i = 0; i < sizeof(probs)/sizeof(probs[0]); ++i) {
for (size_t i = 0; i < sizeof(probs)/sizeof(probs[0]); ++i) {
printf(" %11d%% |",(int)((probs[i]*100)+0.5));
}
printf("\n");

printf("---+");
for (int i = 0; i < sizeof(probs)/sizeof(probs[0]); ++i) {
for (size_t i = 0; i < sizeof(probs)/sizeof(probs[0]); ++i) {
printf("--------------+");
}
printf("\n");

for (int i = 0; i < sizeof(charcounts)/sizeof(charcounts[0]); ++i) {
for (size_t i = 0; i < sizeof(charcounts)/sizeof(charcounts[0]); ++i) {
printf("%2d |",charcounts[i]);
for (int j = 0; j < sizeof(probs)/sizeof(probs[0]); ++j) {
for (size_t j = 0; j < sizeof(probs)/sizeof(probs[0]); ++j) {
double t = log2(1 - probs[j]) / log2(1 - (1 / pow(32,charcounts[i])));
printf(" %12.0f |",t);
}
Expand Down

0 comments on commit d5b90d4

Please sign in to comment.