add numerical recipes library

This commit is contained in:
2025-09-12 18:55:25 +09:00
parent d4dff245bd
commit 2c75620ec9
1344 changed files with 63869 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
typedef struct {
unsigned long *icod,*ncod,*left,*right,nch,nodemax;
} huffcode;
void hufdec(unsigned long *ich, unsigned char *code, unsigned long lcode,
unsigned long *nb, huffcode *hcode)
{
long nc,node;
static unsigned char setbit[8]={0x1,0x2,0x4,0x8,0x10,0x20,0x40,0x80};
node=hcode->nodemax;
for (;;) {
nc=(*nb >> 3);
if (++nc > lcode) {
*ich=hcode->nch;
return;
}
node=(code[nc] & setbit[7 & (*nb)++] ?
hcode->right[node] : hcode->left[node]);
if (node <= hcode->nch) {
*ich=node-1;
return;
}
}
}