mirror of https://github.com/dirtbags/fluffy.git
Compile with older compilers
This commit is contained in:
parent
a95481626c
commit
0d2b592f08
|
@ -7,6 +7,7 @@ main(int argc, char *argv[])
|
|||
size_t len = 0;
|
||||
size_t hist[256] = {0};
|
||||
int c;
|
||||
int i;
|
||||
|
||||
while ((c = getchar()) != EOF) {
|
||||
hist[c] += 1;
|
||||
|
@ -14,7 +15,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
float H = 0;
|
||||
for (int i = 0; i < 256; i += 1) {
|
||||
for (i = 0; i < 256; i += 1) {
|
||||
if (hist[i]) {
|
||||
float Hi = (float)hist[i]/len;
|
||||
H -= Hi * log2(Hi);
|
||||
|
|
Loading…
Reference in New Issue