Buckets:
agent-collaborations/hutter-prize-67 / decoder-bundle-minimization /work /paq8px-src /src /MTFList.cpp
| MTFList::MTFList(const uint16_t n) : root(0), Index(0), previous(n), next(n) { | |
| assert(n > 0); | |
| for( int i = 0; i < n; i++ ) { | |
| previous[i] = i - 1; | |
| next[i] = i + 1; | |
| } | |
| next[n - 1] = -1; | |
| } | |
| int MTFList::getFirst() { | |
| return Index = root; | |
| } | |
| int MTFList::getNext() { | |
| if( Index >= 0 ) { | |
| Index = next[Index]; | |
| } | |
| return Index; | |
| } | |
| void MTFList::moveToFront(const int i) { | |
| assert(uint32_t(i) < previous.size()); | |
| if((Index = i) == root ) { | |
| return; | |
| } | |
| const int p = previous[Index]; | |
| const int n = next[Index]; | |
| if( p >= 0 ) { | |
| next[p] = next[Index]; | |
| } | |
| if( n >= 0 ) { | |
| previous[n] = previous[Index]; | |
| } | |
| previous[root] = Index; | |
| next[Index] = root; | |
| root = Index; | |
| previous[root] = -1; | |
| } |
Xet Storage Details
- Size:
- 753 Bytes
- Xet hash:
- 0adabc0182569ca285eade7856b9da41e028931dd6a7d1a85e0976f4cc7ed224
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.