[PATCH 2/5] crc: use namespace prefix osmo_*

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

pablo at gnumonks.org pablo at gnumonks.org
Sat May 7 11:25:57 UTC 2011


From: Pablo Neira Ayuso <pablo at gnumonks.org>

Summary of changes:

s/crc16_table/osmo_crc16_table/g
s/crc16/osmo_crc16/g
s/crc16_byte/osmo_crc16_byte/g
---
 include/osmocom/core/crc16.h |    8 ++++----
 src/crc16.c                  |    6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/osmocom/core/crc16.h b/include/osmocom/core/crc16.h
index 7a51249..0e52417 100644
--- a/include/osmocom/core/crc16.h
+++ b/include/osmocom/core/crc16.h
@@ -22,13 +22,13 @@
 
 #include <sys/types.h>
 
-extern uint16_t const crc16_table[256];
+extern uint16_t const osmo_crc16_table[256];
 
-extern uint16_t crc16(uint16_t crc, const uint8_t *buffer, size_t len);
+extern uint16_t osmo_crc16(uint16_t crc, const uint8_t *buffer, size_t len);
 
-static inline uint16_t crc16_byte(uint16_t crc, const uint8_t data)
+static inline uint16_t osmo_crc16_byte(uint16_t crc, const uint8_t data)
 {
-	return (crc >> 8) ^ crc16_table[(crc ^ data) & 0xff];
+	return (crc >> 8) ^ osmo_crc16_table[(crc ^ data) & 0xff];
 }
 
 #endif /* __CRC16_H */
diff --git a/src/crc16.c b/src/crc16.c
index 3a0d0dd..2741cf5 100644
--- a/src/crc16.c
+++ b/src/crc16.c
@@ -11,7 +11,7 @@
 #include <osmocom/core/crc16.h>
 
 /** CRC table for the CRC-16. The poly is 0x8005 (x^16 + x^15 + x^2 + 1) */
-uint16_t const crc16_table[256] = {
+uint16_t const osmo_crc16_table[256] = {
 	0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
 	0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,
 	0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40,
@@ -54,9 +54,9 @@ uint16_t const crc16_table[256] = {
  *
  * Returns the updated CRC value.
  */
-uint16_t crc16(uint16_t crc, uint8_t const *buffer, size_t len)
+uint16_t osmo_crc16(uint16_t crc, uint8_t const *buffer, size_t len)
 {
 	while (len--)
-		crc = crc16_byte(crc, *buffer++);
+		crc = osmo_crc16_byte(crc, *buffer++);
 	return crc;
 }
-- 
1.7.2.3





More information about the OpenBSC mailing list