inline void QuadTree_S::GetHuffStrings(BitString * result, long long freq[4], BitString huff[4]) { int order[4], done[4] = {0, 0, 0, 0}; long long max , currentIndex = 0; for (int i = 0; i < 4; ++i) { BitString currentString; for (int j = 0; j < i; ++j) currentString.AppendBit(0); currentString.AppendBit(1); max = 0; for (int j = 0; j < 4; ++j) { if (max <= freq[j] && !done[j]) { currentIndex = j; max = freq[j]; } } huff[currentIndex] = currentString; done[currentIndex] = 1; AppendQuad(result, currentIndex); } }