Skip to content

Commit 13577f9

Browse files
committed
Small tuning of BASE-64 encode/decode algorithm
1 parent a164f6d commit 13577f9

File tree

1 file changed

+9
-1
lines changed
  • include/private/dsp/arch/generic

1 file changed

+9
-1
lines changed

include/private/dsp/arch/generic/coding.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,11 @@ namespace lsp
8787
{
8888
// Enough space?
8989
if (dl < 4)
90-
break;
90+
{
91+
*dst_left = dl;
92+
*src_left = sl;
93+
return n;
94+
}
9195

9296
// Perform encode
9397
uint32_t x = (s[0] << 16) | (s[1] << 8) | s[2];
@@ -147,7 +151,11 @@ namespace lsp
147151
{
148152
// Enough space?
149153
if (dl < 3)
154+
{
155+
*dst_left = dl;
156+
*src_left = sl;
150157
break;
158+
}
151159

152160
x = (base64_lookup[s[0]] << 18) |
153161
(base64_lookup[s[1]] << 12) |

0 commit comments

Comments
 (0)