[PATCH] Add generic LE/BE load/store uint type convertors and use them in msgb
Holger Hans Peter Freyther
holger at freyther.de
Fri Jan 31 12:26:09 CET 2014
On Tue, Jan 14, 2014 at 01:19:03PM +0100, ☎ wrote:
> Hi.
>
> Attached is v2: converted to inline functions, fixed all compiler warnings and
> changed names to osmo_*
>
> Note: there are not much tests but kasumi and msgb code uses store/load routines so
> it could be considered as an indirect test case.
tests is some how important. At least knowing that all routines got
executed at least once.
> +static inline uint16_t osmo_load16le(const uint8_t *p)
> +{//Load unaligned 16-bit integer (little-endian encoding)
C89 didn't have this style of comments. Use /* */ but maybe
consider using api comments above the function instead of
directly after {?
> +static inline uint16_t osmo_load16be(const uint8_t *p)
> +{//Load unaligned 16-bit integer (big-endian encoding)
> + return ((((uint16_t *)(p))[0] << 8) | ((uint16_t *)(p))[1]);
this is not lisp. Can you remove the number of braces? Now
that this is a method you can omit the () around p. In terms
of readability.
> +_kasumi;
> +_kasumi_key_expand;
> +_kasumi_kgcore;
too early. please move that to the later patch.
cheers
holger
More information about the baseband-devel
mailing list