Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix of incorrect type conversion. #562

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ihsinme
Copy link
Contributor

@ihsinme ihsinme commented Jan 4, 2021

used transform (uint64_t) (srtt * srtt) is incorrect. first, the product will be counted in uint32_t, and only then the conversion to uint64_t will be performed.

I couldn't find the importance of preemptive execution (srtt * srtt), so I suggest a simple fix.
however, if the sequence of the product in the expression ((uint64_t) net-> mtu * (uint64_t) (srtt * srtt)) is important, then I can correct the commit to any of the options:

  1. ((uint64_t) srtt * srtt * net-> mtu)
  2. ((uint64_t) net-> mtu * ((uint64_t) srtt * srtt))

I would also pay attention to the comparison if (srtt> 0), given the unsigned nature of srtt, I would suggest replacing it with if (srtt != 0).

used transform (uint64_t) (srtt * srtt) is incorrect. first, the product will be counted in uint32_t, and only then the conversion to uint64_t will be performed.

I couldn't find the importance of preemptive execution (srtt * srtt), so I suggest a simple fix.
however, if the sequence of the product in the expression ((uint64_t) net-> mtu * (uint64_t) (srtt * srtt)) is important, then I can correct the commit to any of the options:
1. ((uint64_t) srtt * srtt * net-> mtu)
2. ((uint64_t) net-> mtu * ((uint64_t) srtt * srtt))

I would also pay attention to the comparison if (srtt> 0), given the unsigned nature of srtt, I would suggest replacing it with if (srtt != 0).
@ihsinme
Copy link
Contributor Author

ihsinme commented Feb 5, 2021

good day.
tell me if I still need to do something in this PR.

@tuexen
Copy link
Member

tuexen commented Feb 5, 2021

No, it's fine. Just need to contemplate what the code should be...

@ihsinme
Copy link
Contributor Author

ihsinme commented Feb 11, 2022

is there any news on this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants