Browse Source

Slightly optimize base64 encode.

Move handling of last byte outside of innermost loop.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
tags/n0.10
Reimar Döffinger 13 years ago
parent
commit
d60d718c49
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      libavutil/base64.c

+ 3
- 1
libavutil/base64.c View File

@@ -93,8 +93,10 @@ char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size)
do {
*dst++ = b64[(i_bits << 6 >> i_shift) & 0x3f];
i_shift -= 6;
} while (i_shift > 6 || (bytes_remaining == 0 && i_shift > 0));
} while (i_shift > 6);
}
if (i_shift > 0)
*dst++ = b64[(i_bits << 6 >> i_shift) & 0x3f];
while ((dst - ret) & 3)
*dst++ = '=';
*dst = '\0';


Loading…
Cancel
Save