diff options
author | Damien Zammit <damien@zamaudio.com> | 2015-07-25 03:29:32 +1000 |
---|---|---|
committer | Damien Zammit <damien@zamaudio.com> | 2015-07-25 03:29:32 +1000 |
commit | a7cb697abb4ba2b3301246592b7210bf6c485ddc (patch) | |
tree | 48c43a3eabb5ba6168c5581d6c90bda82156e8a4 | |
parent | d549afffa950ee90cb6fab48e17445221ac26cc0 (diff) |
Fixed start offset byte-lengthreset
Signed-off-by: Damien Zammit <damien@zamaudio.com>
-rw-r--r-- | ptfformat.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/ptfformat.cc b/ptfformat.cc index 4ecd44c..04d6348 100644 --- a/ptfformat.cc +++ b/ptfformat.cc @@ -351,10 +351,20 @@ PTFFormat::parse(void) { //offset offset = 0; - offset |= (uint32_t)(ptfunxored[j]); - offset |= (uint32_t)(ptfunxored[j+1] << 8); - offset |= (uint32_t)(ptfunxored[j+2] << 16); - offset |= (uint32_t)(ptfunxored[j+3] << 24); + startbytes = (ptfunxored[k+3] & 0xf0) >> 4; + + switch (startbytes) { + case 4: + offset |= (uint32_t)(ptfunxored[j+3] << 24); + case 3: + offset |= (uint32_t)(ptfunxored[j+2] << 16); + case 2: + offset |= (uint32_t)(ptfunxored[j+1] << 8); + case 1: + offset |= (uint32_t)(ptfunxored[j]); + default: + break; + } of->posabsolute = (uint32_t)offset; of++; } |