[riot-notifications] [RIOT-OS/RIOT] sys/base64: Add size estimation functions (#10796)
notifications at github.com
Wed Jan 23 16:59:22 CET 2019
danpetry requested changes on this pull request.
unittests/tests-base64 still run and pass on native and samr21-xpro.
Please address the comment, then squash and rebase and I'll be happy to ACK
> + */
+static inline size_t base64_estimate_decode_size(size_t base64_in_size)
+ return ((base64_in_size / 4) * 3);
+ * @brief Estimates the length of the resulting string after encoding
+ * @p data_in_size bytes into base64.
+ * @param[in] data_in_size Amount of bytes to be encoded
+ * @return Amount of characters the output string is estimated to have
+static inline size_t base64_estimate_encode_size(size_t data_in_size)
+ return (4 * ((data_in_size + 2) / 3));
[CCN-LITE](https://github.com/cn-uofbasel/ccn-lite/blob/master/src/ccnl-utils/src/base64.c) adds a +1 to the end of this. Which would make the following check in `base64_encode()` more tight, so it's worth knowing why. Do you have an idea why they have this?
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications