summaryrefslogtreecommitdiffstats
path: root/include/osmocom/core/bits.h
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2016-06-17 17:58:52 +0200
committerMax <msuraev@sysmocom.de>2016-06-20 19:02:56 +0200
commite0a7d9e2c220e5544ee8982c78851ff40ac425bc (patch)
tree5b3c65a05ef3ab52f4808dae5f3632f8fdebe960 /include/osmocom/core/bits.h
parent136e73764e7f58e52ffb13d01304fef30eb7d291 (diff)
Add octet-aligned/unaligned shift functions
The actual code is from OsmoBTS' tch.c by Harald Welte. Add unit tests, doxygen annotation and extra memory safety check. Those functions are used in several BTS implementations but seems generic enough to be generally useful. Change-Id: I2b1901c4161e8035f059585901dca593b661556d
Diffstat (limited to 'include/osmocom/core/bits.h')
-rw-r--r--include/osmocom/core/bits.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/osmocom/core/bits.h b/include/osmocom/core/bits.h
index 3218330b..5535920e 100644
--- a/include/osmocom/core/bits.h
+++ b/include/osmocom/core/bits.h
@@ -41,6 +41,11 @@ int osmo_ubit2pbit(pbit_t *out, const ubit_t *in, unsigned int num_bits);
int osmo_pbit2ubit(ubit_t *out, const pbit_t *in, unsigned int num_bits);
+void osmo_nibble_shift_right(uint8_t *out, const uint8_t *in,
+ unsigned int num_nibbles);
+void osmo_nibble_shift_left_unal(uint8_t *out, const uint8_t *in,
+ unsigned int num_nibbles);
+
void osmo_ubit2sbit(sbit_t *out, const ubit_t *in, unsigned int num_bits);
void osmo_sbit2ubit(ubit_t *out, const sbit_t *in, unsigned int num_bits);