From patchwork Wed Jun 4 17:07:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max X-Patchwork-Id: 356046 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ganesha.gnumonks.org (ganesha.gnumonks.org [IPv6:2001:780:45:1d:225:90ff:fe52:c662]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 437CB14007B for ; Thu, 5 Jun 2014 03:22:58 +1000 (EST) Received: from localhost ([127.0.0.1] helo=ganesha.gnumonks.org) by ganesha.gnumonks.org with esmtp (Exim 4.72) (envelope-from ) id 1WsEsk-0003Jj-Gg; Wed, 04 Jun 2014 19:21:47 +0200 Received: from hylle06.itea.ntnu.no ([129.241.56.235]) by ganesha.gnumonks.org with esmtp (Exim 4.72) (envelope-from ) id 1WsEfK-0000NM-68 for baseband-devel@lists.osmocom.org; Wed, 04 Jun 2014 19:07:59 +0200 Received: from localhost (localhost [127.0.0.1]) by hylle06.itea.ntnu.no (Postfix) with ESMTP id DBA4B666366 for ; Wed, 4 Jun 2014 19:07:53 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at hylle06.itea.ntnu.no Received: from alumnimail.it.ntnu.no (alumnimail.it.ntnu.no [129.241.18.22]) by hylle06.itea.ntnu.no (Postfix) with ESMTP id 93E91666310 for ; Wed, 4 Jun 2014 19:07:53 +0200 (CEST) Received: from localhost (nat.sec.t-labs.tu-berlin.de [130.149.230.1]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: suraev) by alumnimail.it.ntnu.no (Postfix) with ESMTPSA id 6E688580531 for ; Wed, 4 Jun 2014 19:07:53 +0200 (CEST) From: Max Suraev To: baseband-devel@lists.osmocom.org Subject: [PATCH 2/3] Add left circular shift function Date: Wed, 4 Jun 2014 19:07:42 +0200 Message-Id: <1401901663-16418-2-git-send-email-Max.Suraev@fairwaves.co> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1401901663-16418-1-git-send-email-Max.Suraev@fairwaves.co> References: <1401901663-16418-1-git-send-email-Max.Suraev@fairwaves.co> X-Spam-Score: -2.3 (--) X-BeenThere: baseband-devel@lists.osmocom.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Development discussion about Osmocom BaseBand List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: baseband-devel-bounces@lists.osmocom.org Errors-To: baseband-devel-bounces@lists.osmocom.org --- include/osmocom/core/bits.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/osmocom/core/bits.h b/include/osmocom/core/bits.h index 5c9c7a6..c2c4863 100644 --- a/include/osmocom/core/bits.h +++ b/include/osmocom/core/bits.h @@ -78,6 +78,16 @@ 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, [0;16] bits + * \returns shifted value + */ +static inline uint16_t osmo_rol16(uint16_t in, unsigned shift) +{ + return (in << shift) | (in >> (16 - shift)); +} + /*! @} */ #endif /* _OSMO_BITS_H */