Message ID | 1395083030-30425-2-git-send-email-max.suraev@fairwaves.co |
---|---|
State | Superseded, archived |
Headers | show |
Hi, > +/*! \brief left circular shift > + * \param[in] in The 16 bit unsigned integer to be rotated > + * \param[in] shift Number of bits to shift \a in to > + */ Missing the \returns And yes, I know it's sometimes trivial but when processed by Doxygen you have everything nicely hyperlinked if you filled everything out. While you're at it, you could add the valid range to 'shift' doc (seems to be 0 to 16 included). Could seem obvious but at least it removes any doubt (that for example using negative would do a ror ... or that it would handle multiple complete rotation). Also please _wait_ until the next re-spin. I haven't looked at the third patch yet and haven't tried to actually _run_ them. I'm just sending this feedback know so that you know I'm looking at it, but since I've been away for 2 weeks, I have a bunch of stuff to catch up on. Cheers, Sylvain
diff --git a/include/osmocom/core/bits.h b/include/osmocom/core/bits.h index b1f4ed6..98a42f9 100644 --- a/include/osmocom/core/bits.h +++ b/include/osmocom/core/bits.h @@ -76,6 +76,15 @@ uint32_t osmo_revbytebits_8(uint8_t x); /* \brief reverse the bits of each byte in a given buffer */ void osmo_revbytebits_buf(uint8_t *buf, int len); +/*! \brief left circular shift + * \param[in] in The 16 bit unsigned integer to be rotated + * \param[in] shift Number of bits to shift \a in to + */ +static inline uint16_t osmo_rol16(uint16_t in, unsigned shift) +{ + return (in << shift) | (in >> (16 - shift)); +} + /*! @} */ #endif /* _OSMO_BITS_H */