Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Base64: Pre-allocate strings when encoding/decoding
- Loading branch information
Showing
1 changed file
with
3 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4e02fe9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The maths were from the for loops and can be verified by stepping different length inputs in, if that makes sense
4e02fe9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Math looks fine from a general 6<->8 bit encoding (3/4).
I suspect more optimisation could come from taking the conditionals out of the loops (i.e. first loop running up to length - 2), plus the second routine should probably run backwards through the string to find the length. Ofcourse, only after careful profiling that it actually makes a difference, ideally on i386 and arm.