[0080] bytevector-base64-decode 下沉到 native C++ 实现#878
Merged
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
(liii base64)的bytevector-base64-decode从纯 Scheme 实现下沉到 native C++,完全保留 [0079] 修复后的语义契约(36 个 check 全部通过)src/liii_base64.cpp,仿照liii_hashlib.cpp的 glue 模式,自写 decode 主循环并严格按 0079 契约校验(长度 4X、字符集、=填充位置)Why native 而非复用 tbox
tbox 的
tb_base64_decode签名(返回 size_t、无错误码)与 0079 严格契约不兼容:对=Zm9/Zg=v/====/长度非 4X 等输入不报错,遇到非法字符直接return 0也无法与合法空输入区分。因此在src/liii_base64.cpp中自写 decode,仅复用 tbox 的类型风格。Test plan
xmake b goldfish构建通过bin/gf fmt格式化通过bin/gf tests/liii/base64/bytevector-base64-decode-test.scm— 36 correct, 0 failedbin/gf tests/liii/base64/base64-encode-test.scm— 10 correct, 0 failedbin/gf tests/liii/base64/base64-decode-test.scm— 9 correct, 0 failedbin/gf bench/base64-perf.scm性能基准复核