Go to the documentation of this file.
179 #define INDEX(i,j,k) (((size_t)((i-1)>>1)*((i-2)>>1)+(j>>1)-1)*(max-1)+k-1)
227 least = (left << 1) -
syms;
239 for (use = least; use <= most; use++) {
242 if (got == (
big_t)0 - 1 ||
sum < got)
271 bit = 1 << (
mem & 7);
297 vector = calloc(
length,
sizeof(
char));
301 if (vector == NULL) {
302 fputs(
"abort: unable to allocate enough memory\n",
stderr);
345 for (use =
root + 1; use <=
max; use++)
363 least = (left << 1) -
syms;
383 for (use = least; use <= most; use++) {
386 mem + (rem ? 1 << (
len -
root) : 0), rem << 1);
410 for (
n = 0;
n <=
max;
n++)
417 for (left = 2; left <
n; left += 2)
433 printf(
"done: maximum of %d table entries\n",
large);
458 int main(
int argc,
char **argv)
476 syms = atoi(argv[1]);
478 root = atoi(argv[2]);
484 fputs(
"invalid arguments, need: [sym >= 2 [root >= 1 [max >= 1]]]\n",
494 for (
n = 0, word = 1; word;
n++, word <<= 1)
499 fputs(
"abort: code length too long for internal types\n",
stderr);
505 fprintf(
stderr,
"%d symbols cannot be coded in %d bits\n",
511 code = calloc(
max + 1,
sizeof(
int));
513 fputs(
"abort: unable to allocate enough memory\n",
stderr);
523 if (
size > ((
size_t)0 - 1) / (
n = (
syms - 1) >> 1) ||
527 fputs(
"abort: unable to allocate enough memory\n",
stderr);
538 if (got == (
big_t)0 - 1 ||
sum < got) {
539 fputs(
"abort: can't count that high!\n",
stderr);
543 printf(
"%llu %d-codes\n", got,
n);
549 puts(
" (no length limit)");
554 else if (
size > ((
size_t)0 - 1) /
sizeof(
struct tab) ||
555 (
done = calloc(
size,
sizeof(
struct tab))) == NULL) {
556 fputs(
"abort: unable to allocate enough memory\n",
stderr);
567 puts(
"cannot handle minimum code lengths > root");
void examine(int syms, int len, int left, int mem, int rem)
return memset(p, 0, total)
double sum(const T &container, F functor)
_Use_decl_annotations_ int __cdecl printf(const char *_Format,...)
int main(int argc, char **argv)
int beenhere(int syms, int len, int left, int mem, int rem)
big_t count(int syms, int len, int left)
unsigned long long code_t
grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:19