Skip to content

Conversation

@kishanshukla-2307
Copy link

@kishanshukla-2307 kishanshukla-2307 commented Mar 2, 2020

…cation.
a *= 2 here 'a' would overflow if we change the base to INT_MAX. overflow can't occur when a < INT_MAX/2, therefore, the code was working only for base < INT_MAX/2. but now I have changed a *= 2 to a = (a+a)%base which is working for base INT_MAX. (only for multiplication)

@sdkrystian
Copy link

sdkrystian commented Mar 7, 2020

Make sure to guard those calls to min and max.

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