1.1: Comment updates
This commit is contained in:
parent
13d8bd852c
commit
feaedd8194
1 changed files with 1 additions and 1 deletions
|
@ -31,11 +31,11 @@ pub fn base64(hex: &str) -> Result<String, String> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if acc != 0 {
|
if acc != 0 {
|
||||||
|
// Pad the string if we have bits remaining.
|
||||||
acc = acc << (24 - num_bits);
|
acc = acc << (24 - num_bits);
|
||||||
let padding = (24 - num_bits) / 6;
|
let padding = (24 - num_bits) / 6;
|
||||||
for i in (0..4).rev() {
|
for i in (0..4).rev() {
|
||||||
let out_char_idx = ((acc >> (6 * i)) & 0x3F) as usize;
|
let out_char_idx = ((acc >> (6 * i)) & 0x3F) as usize;
|
||||||
// TODO: I don't like this nth() call.
|
|
||||||
if i < padding {
|
if i < padding {
|
||||||
out.push('=');
|
out.push('=');
|
||||||
} else if let Some(out_char) = B64.chars().nth(out_char_idx) {
|
} else if let Some(out_char) = B64.chars().nth(out_char_idx) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue