static void* access_pcm(struct track *tr, size_t *len) { unsigned int block; size_t fill; block = tr->bytes / TRACK_BLOCK_PCM_BYTES; if (block == tr->blocks) { if (more_space(tr) == -1) return NULL; } fill = tr->bytes % TRACK_BLOCK_PCM_BYTES; *len = TRACK_BLOCK_PCM_BYTES - fill; return (void*)tr->block[block]->pcm + fill; }
void Trie::add_word(int binaryCode, int codeLen, int lit) { if (lit < 0 || lit > 287) throw WrongValExc(lit); int c = 0; for (int i = codeLen - 1; i >= 0; --i) { int bit = GETBIT(binaryCode, i); if (arr[bit][c] > 0) c = arr[bit][c]; else c = arr[bit][c] = ++arrLen; if (c >= arr[0].size()) more_space(); } arr[2][c] = 1; arr[3][c] = lit; }