in reply to Re^2: Unpack Fail to Decompress String?
in thread Unpack Fail to Decompress String?
string length +1 modulo 4 is the same as the number of significant characters in the last byte. I.e. that is an implementation detail I left out on purpose.
If you mean comparision for equality, then putting the count into the first byte will be a lot faster for 75% of different-length strings and not much slower for same-length strings. Only if you want to know the first position at which they differ is the last byte better.
The advantage I see for last byte is that you can more easily append or cut from the end of the compressed string
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Unpack Fail to Decompress String?
by gone2015 (Deacon) on Jan 09, 2009 at 19:11 UTC |