You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/11/12 02:14:11 UTC

[GitHub] [rocketmq] ShadowySpirits commented on issue #5462: About RemotingCommand.decode parse header is a repeated calculation

ShadowySpirits commented on issue #5462:
URL: https://github.com/apache/rocketmq/issues/5462#issuecomment-1312319073

   > > > in org.apache.rocketmq.remoting.protocol.RemotingCommand.decode method,Through ByteBuf calculate command header is a repeated operation ![9d46829acedd84860f01afeee22947a](https://user-images.githubusercontent.com/26542900/199681279-30bf2d27-2eb8-44e8-accf-69f79a3ffe9b.png)
   > > 
   > > 
   > > This is not a repeated operation. This operation is to solve the problem of java coding. You can search for "the meaning of doing 0xFFFFF & operation" with the browser~
   > 
   > Can you tell me the meaning of doing 0xFFFFFF & operation?I tried to search the browser but didn't find the relevant results.please.
   
   We use byte(0-255) to transfer data via network. But java doesn't support unsigned int, so we should use 0xFFFFFF & operation to get unsigned int. See [this blog (Chinese ver)](https://blog.lv5.moe/p/the-mathematical-principle-of-ones-complement-and-twos-complement) for more info about how could we do this.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org