[riot-notifications] [RIOT-OS/RIOT] sys/base64: Add size estimation functions (#10796)
notifications at github.com
Thu Jan 24 08:33:02 CET 2019
leandrolanzieri commented on this pull request.
> + */
+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));
I think it may be due to the fact that their 'output' is a NULL-terminated array of characters, so they add that extra byte at the end.
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