[
https://issues.apache.org/jira/browse/THRIFT-3885?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15390781#comment-15390781
]
ASF GitHub Bot commented on THRIFT-3885:
----------------------------------------
Github user czm1989 commented on the issue:
https://github.com/apache/thrift/pull/1052
@nsuke Yes, I agree.
It also can simply be `$hi |= (($byte & 0x7f) >> 4);` because of the shift
is only 28 that satisfy the condition.
But according to the algorithm of writeVarint, I think
`elseif ($shift > 25) {
$hi |= (($byte & 0x7f) >> (32 - $shift));
}`
to be the best.
(When the shift is 25, the 7 bit only fill in the low 32bits. so the
condition should be `$shift > 25`.)
Thanks for reading.
> PHP: Error when readI64 in TCompactProtocol
> -------------------------------------------
>
> Key: THRIFT-3885
> URL: https://issues.apache.org/jira/browse/THRIFT-3885
> Project: Thrift
> Issue Type: Bug
> Components: PHP - Library
> Affects Versions: 0.7, 0.8, 0.9, 0.9.1, 0.9.2, 0.9.3
> Environment: all
> Reporter: Chen Zhiming
> Labels: patch
>
> In line 618 of readI64 of TCompactProtocol, the number of shift bit is error.
> It must be
> $hi |= (($byte & 0x7f) >> (7 - ($shift - 25)));
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)