On 02/12/2024 13:24, Vikash Garodia wrote:
If you see, words_count is doing the role of remaining_size. In existing implementation as well, we can move those increments per case to once per loop, just that to avoid incrementing for default case.
Yes.
To me it seems
- A redundant step to have words_count - That the functions themselves should return the amount of bytes words += should increment by - That you could do that words += outside of the switch instead of at each case:
but to be clear the logic of incrementing the words looks right to me now, I'm suggesting additional stylistic change.
--- bod