2011/12/22 Shahansad K.P <[email protected]>:
>   n -= '0' * ((int)s - (int)p) / sizeof(*s);
>
> Is unsafe. Left hand side can gorw very fast and would limit the size of
> string on which the function can run.

Well yes it's not very safe indeed.

But if you replace "int" by "unsigned long", you can process up to 287
PBytes of data.
It seems enough for me :)

Knowing the string length in advance could make the process a lot
faster by processing an bunch of integers in the loop instead of just
1.
But calculating the string length just for that purpose may slower the
process, what do you think?

-- 
Jérémie MARGUERIE
Étudiant à l'EPITA, ing2

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.

Reply via email to