diff options
author | Kari Salminen | 2008-06-10 22:37:55 +0000 |
---|---|---|
committer | Kari Salminen | 2008-06-10 22:37:55 +0000 |
commit | efc4fd7ae0f106f2cfe9d9109b3331604f97be9c (patch) | |
tree | 9c5d6d0185b7b659b2e8636c15a552dac973e3e0 /engines/cine | |
parent | 235504e60000f3c74c262b9b54fcb4cc9ff6f126 (diff) | |
download | scummvm-rg350-efc4fd7ae0f106f2cfe9d9109b3331604f97be9c.tar.gz scummvm-rg350-efc4fd7ae0f106f2cfe9d9109b3331604f97be9c.tar.bz2 scummvm-rg350-efc4fd7ae0f106f2cfe9d9109b3331604f97be9c.zip |
A little Delphine unpacker documentation addition and variable renaming.
svn-id: r32660
Diffstat (limited to 'engines/cine')
-rw-r--r-- | engines/cine/unpack.cpp | 28 | ||||
-rw-r--r-- | engines/cine/unpack.h | 10 |
2 files changed, 22 insertions, 16 deletions
diff --git a/engines/cine/unpack.cpp b/engines/cine/unpack.cpp index 7afeeb1509..8e775c3632 100644 --- a/engines/cine/unpack.cpp +++ b/engines/cine/unpack.cpp @@ -36,23 +36,23 @@ uint32 CineUnpacker::readSource() { return value; } -int CineUnpacker::rcr(int CF) { - int rCF = (_chk & 1); - _chk >>= 1; - if (CF) { - _chk |= 0x80000000; +int CineUnpacker::rcr(int inputCarry) { + int outputCarry = (_chunk32b & 1); + _chunk32b >>= 1; + if (inputCarry) { + _chunk32b |= 0x80000000; } - return rCF; + return outputCarry; } int CineUnpacker::nextBit() { - int CF = rcr(0); - if (_chk == 0) { - _chk = readSource(); - _crc ^= _chk; - CF = rcr(1); + int carry = rcr(0); + if (_chunk32b == 0) { + _chunk32b = readSource(); + _crc ^= _chunk32b; + carry = rcr(1); } - return CF; + return carry; } uint16 CineUnpacker::getBits(byte numBits) { @@ -85,8 +85,8 @@ bool CineUnpacker::unpack(byte *dst, const byte *src, int srcLen) { _datasize = readSource(); _dst = dst + _datasize - 1; _crc = readSource(); - _chk = readSource(); - _crc ^= _chk; + _chunk32b = readSource(); + _crc ^= _chunk32b; do { if (!nextBit()) { if (!nextBit()) { diff --git a/engines/cine/unpack.h b/engines/cine/unpack.h index c401c8679b..894d59d0b4 100644 --- a/engines/cine/unpack.h +++ b/engines/cine/unpack.h @@ -38,7 +38,13 @@ public: private: /** Reads a single big endian 32-bit integer from the source and goes backwards 4 bytes. */ uint32 readSource(); - int rcr(int CF); + + /** + * Shifts the current internal 32-bit chunk to the right by one. + * Puts input carry into internal chunk's topmost (i.e. leftmost) bit. + * Returns the least significant bit that was shifted out. + */ + int rcr(int inputCarry); int nextBit(); uint16 getBits(byte numBits); void unpackBytes(uint16 numBytes); @@ -46,7 +52,7 @@ private: private: int _datasize; uint32 _crc; - uint32 _chk; + uint32 _chunk32b; //!< The current internal 32-bit chunk byte *_dst; const byte *_src; }; |