[riot-notifications] [RIOT-OS/RIOT] sys/luid: provide luid_get_be(), fix documentation (#14016)

benpicco notifications at github.com
Mon May 4 16:32:37 CEST 2020




### Contribution description

The documentation of `luid_get()` is wrong, or at least confusing.

It talks about

> an 8-bit incrementing counter value into the most significant byte

while the implementation does

```C
((uint8_t *)buf)[0] ^= lastused++;
```

Now it could be argued that the intention was that the ID is supposed to be used in Big Endian contexts and that was an omission, however to keep everyone's sanity, let's keep it simple and just state that this actually changes the LSB.

Also add a `luid_get_be()` function that does the same, but modifies the most significant bit - or the least significant one if interpreted as Big Endian.


### Testing procedure




### Issues/PRs references

This can be used directly by e.g. #13743

You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/14016

-- Commit Summary --

  * sys/luid: provide luid_get_be(), fix documentation

-- File Changes --

    M sys/include/luid.h (19)
    M sys/luid/luid.c (7)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/14016.patch
https://github.com/RIOT-OS/RIOT/pull/14016.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/14016
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200504/fa748557/attachment.htm>


More information about the notifications mailing list