[riot-notifications] [RIOT-OS/RIOT] net/coap: Block optimizations (#11057)

Ken Bannister notifications at github.com
Mon Sep 30 14:37:35 CEST 2019

kb2ma commented on this pull request.

> @@ -614,20 +614,6 @@ size_t coap_put_option(uint8_t *buf, uint16_t lastonum, uint16_t onum, const uin
     return (size_t)n;
-size_t coap_put_option_ct(uint8_t *buf, uint16_t lastonum, uint16_t content_type)
-    if (content_type == 0) {
-        return coap_put_option(buf, lastonum, COAP_OPT_CONTENT_FORMAT, NULL, 0);
-    }
-    else if (content_type <= 255) {
-        uint8_t tmp = content_type;
-        return coap_put_option(buf, lastonum, COAP_OPT_CONTENT_FORMAT, &tmp, sizeof(tmp));
-    }
-    else {
-        return coap_put_option(buf, lastonum, COAP_OPT_CONTENT_FORMAT, (uint8_t *)&content_type, sizeof(content_type));
-    }
 static unsigned _size2szx(size_t size)

Yes, use of the enum would require modification of the slicer. I will defer any changes there. Eventually, I would like to see a "payload writer" that uses blockwise by default. That would be a good time to revisit the capabilities of the slicer.

Thanks for the reference to the builtin functions. I have not used them before. It looks like  bitarithm_lsb() wraps the use of the clz feature based on availability, so that's what I went with. Let me know if there is a better way.

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...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190930/bd22c53a/attachment.htm>

More information about the notifications mailing list