You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by GitBox <gi...@apache.org> on 2021/02/08 18:04:50 UTC

[GitHub] [qpid-proton] astitcher edited a comment on pull request #295: fix invalid unsigned arithmetic.

astitcher edited a comment on pull request #295:
URL: https://github.com/apache/qpid-proton/pull/295#issuecomment-775332803


   Apologies, you are correct that the test is useless and will always return true, due to the unsigned. But your fix is incorrect because it fails to understand the intent of the test!
   
   The test is attempting to make sure that the hwm is ahead of the lwm, but if the lwm is (for a 16 bit example)at 0xffff and the hwm is at 0x0003 then the test should indeed be true (because of the wrapping nature of the buffer), but in your 'fix' it will be false.
   
   I think the correct test is something like hwm-lwm >0 && hwm-lwm< 0x8000 (in the 16 bit case).
   [Edit to fix the proposed correct test]


----------------------------------------------------------------
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org