Commit Graph

22 Commits

Author SHA1 Message Date
Oliver Smith 04bfb7165b treewide: remove FSF address
Remove the paragraph about writing to the Free Software Foundation's
mailing address. The FSF has changed addresses in the past, and may do
so again. In 2021 this is not useful, let's rather have a bit less
boilerplate at the start of source files.

Change-Id: I5050285e75cf120407a1d883e99b3c4bcae8ffd7
2021-12-14 12:44:03 +01:00
Harald Welte 2ba641edaa bits.c: Use faster look-up-table approach for osmo_revbytebits_{buf,u8}
Benchmarking has shown that a look-up table based approach is much
faster than the arithmetic approach we used so far.

This is from a Core i7-6600U:

10    bytes, 1     iterations: flip=379, revb=5491; revb = 1448 %
10    bytes, 10    iterations: flip=728, revb=1517; revb = 208 %
10    bytes, 100   iterations: flip=2952, revb=9305; revb = 315 %
10    bytes, 1000  iterations: flip=26305, revb=90953; revb = 345 %
100   bytes, 1     iterations: flip=468, revb=1093; revb = 233 %
100   bytes, 10    iterations: flip=2634, revb=7418; revb = 281 %
100   bytes, 100   iterations: flip=23666, revb=70718; revb = 298 %
100   bytes, 1000  iterations: flip=237595, revb=900555; revb = 379 %
1024  bytes, 1     iterations: flip=3417, revb=11454; revb = 335 %
1024  bytes, 10    iterations: flip=33579, revb=92353; revb = 275 %
1024  bytes, 100   iterations: flip=555399, revb=1196228; revb = 215 %
1024  bytes, 1000  iterations: flip=3478271, revb=9227966; revb = 265 %
1048576 bytes, 1     iterations: flip=10189583, revb=7022193; revb = 68 %
1048576 bytes, 10    iterations: flip=19693347, revb=54389925; revb = 276 %
1048576 bytes, 100   iterations: flip=151308243, revb=454293151; revb = 300 %
1048576 bytes, 1000  iterations: flip=1390338439, revb=4429862642; revb = 318 %

where 'revb' is the old arithmetic approach, and 'flip' the new
look-up-table approach. In our usual cases of 100..1024 bytes in a
single iteration, the old code takes 233..335% of the look-up table.

Benchmarks on an Atom E6xx also show improvements except in one
situation (a single iteration over one 1MB large buffer).

10    bytes, 1     iterations: flip=416, revb=9184; revb = 2207 %
10    bytes, 10    iterations: flip=1960, revb=4024; revb = 205 %
10    bytes, 100   iterations: flip=13624, revb=32408; revb = 237 %
10    bytes, 1000  iterations: flip=160656, revb=361784; revb = 225 %
100   bytes, 1     iterations: flip=3536, revb=4952; revb = 140 %
100   bytes, 10    iterations: flip=12960, revb=20912; revb = 161 %
100   bytes, 100   iterations: flip=122448, revb=215152; revb = 175 %
100   bytes, 1000  iterations: flip=1204928, revb=1647680; revb = 136 %
1024  bytes, 1     iterations: flip=12944, revb=23128; revb = 178 %
1024  bytes, 10    iterations: flip=126192, revb=239784; revb = 190 %
1024  bytes, 100   iterations: flip=1190184, revb=1491672; revb = 125 %
1024  bytes, 1000  iterations: flip=11865872, revb=15113872; revb = 127 %
1048576 bytes, 1     iterations: flip=16288272, revb=15925888; revb = 97 %
1048576 bytes, 10    iterations: flip=121957000, revb=157883384; revb = 129 %
1048576 bytes, 100   iterations: flip=1219264992, revb=1621265216; revb = 132 %
1048576 bytes, 1000  iterations: flip=12219520648, revb=15960035856; revb = 130 %

Change-Id: I25029fe7e54c92979fb0119992fb8dc167e1536e
2020-08-02 11:30:31 +02:00
Harald Welte e08da97570 Fix/Update copyright notices; Add SPDX annotation
Let's fix some erroneous/accidential references to wrong license,
update copyright information where applicable and introduce a
SPDX-License-Identifier to all files.

Change-Id: I39af26c6aaaf5c926966391f6565fc5936be21af
2017-11-13 01:35:12 +09:00
Harald Welte ef7a44e33d [doc] bits.c: Better / more Doxygen documentation
Change-Id: If824a5c8d8ee6e3dc96a3fddeb105786c0c027c1
2017-10-16 14:19:12 +02:00
Neels Hofmeyr 17518fe393 doxygen: unify use of \file across the board
Considering the various styles and implications found in the sources, edit
scores of files to follow the same API doc guidelines around the doxygen
grouping and the \file tag.

Many files now show a short description in the generated API doc that was so
far only available as C comment.

The guidelines and reasoning behind it is documented at
https://osmocom.org/projects/cellular-infrastructure/wiki/Guidelines_for_API_documentation

In some instances, remove file comments and add to the corresponding group
instead, to be shared among several files (e.g. bitvec).

Change-Id: Ifa70e77e90462b5eb2b0457c70fd25275910c72b
2017-06-23 00:18:23 +00:00
Neels Hofmeyr 87e4550585 doxygen: enable AUTOBRIEF, drop \brief
Especially for short descriptions, it is annoying to have to type \brief for
every single API doc.

Drop all \brief and enable the AUTOBRIEF feature of doxygen, which always takes
the first sentence of an API doc as the brief description.

Change-Id: I11a8a821b065a128108641a2a63fb5a2b1916e87
2017-06-23 00:18:22 +00:00
Harald Welte 96e2a00d7a update/extend doxygen documentation
It's a pity that even with this patch we still are fare away from having
the whole API documented.  However, at least we have a more solid
foundation.  Updates not only extend the documentation, but also make
sure it is rendered properly in the doxygen HTML.

Change-Id: I1344bd1a6869fb00de7c1899a8db93bba9bafce3
2017-06-12 21:55:54 +00:00
Max e0a7d9e2c2 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
2016-06-20 19:02:56 +02:00
Harald Welte 2d2e2cca0d Update doxygen annotations in libosmocore
This adds and improves doxygen API descriptions all over libosmocore,
reducing the 'white spots' that don't have any documentation.
2016-05-05 18:49:27 +02:00
Max d8fb14226f Add ubit <-> sbit convertors
Move functions for conversion between soft and unpacked bits to main
library as they are generally useful.
2016-04-12 10:10:44 -04:00
Max 08621a8ebb bitvec: Fix unaligned memory access in osmo_revbytebits_buf
The undefined behavior sanitizer found the 32bit load from an
unaligned memory address. This will cause an exception on ARMv5te
and a manual fix-up.

[hfreyther: On armv6, x86 the usage of memcpy leads to shorter
amount of instructions but on armv5te the memcpy is not expanded
leading to a branch. Use the version of max until we have the time
to benchmark it]

Sponsored-by: On-Waves ehf
2016-01-22 23:21:58 +01:00
Harald Welte 468b64331a add missing copyright statements to source code files
Some source code files didn't have the usual copyright and licence
statement at their top.  I'm adding them baesed on information in the
commitlog.
2014-09-11 13:18:08 +08:00
Katerina Barone-Adesi c28c6a02d2 misc: Doxygen tweaks: fixed some typos and minor errors
Doxygen generates quite a lot of warnings on libosmocore. Some of them
are obvious typos - this patch aims to fix such low-hanging fruit.
2013-02-15 13:27:59 +01:00
Harald Welte de6e4983e7 add some missing doxygen annotation for libosmocore functions 2013-01-11 09:43:32 +01:00
Sylvain Munaut 01e0604637 core/bits: Prevent osmo_revbytebits_buf stack trashing
The second loop in osmo_revbytebits_buf() in src/bits.c grabs
4 bytes each iteration, which can easily go past the supplied
input in some cases.

Compiled with -fstack-protector , I get a "stack smashing detected"
in the bits test.

From: Nils O. Selåsdal <noselasd@fiane.dyndns.org>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-01-03 09:37:16 +01:00
Sylvain Munaut dca7d2caaa doc: Fix the Doxygen section endings
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-04-18 21:53:23 +02:00
Harald Welte 712691d8d8 add functions for bit-reversal
Sometimes we need stuff like reversing every bit in each byte (but not
the byte-order).
2011-09-01 14:47:31 +02:00
Harald Welte ba6988bd89 some more doxygen work (include the notion of modules) 2011-08-17 17:14:11 +02:00
Pablo Neira Ayuso 8341934844 include: reorganize headers file to include/osmocom/[gsm|core]
This patch moves all GSM-specific definitions to include/osmocom/gsm.
Moreover, the headers in include/osmocore/ have been moved to
include/osmocom/core.

This has been proposed by Harald Welte and Sylvain Munaunt.

Tested with `make distcheck'.

Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-03-23 18:09:28 +01:00
Christian Vogel c7f84e91b7 ubit2pbit flushes at the wrong moment, added one note to bits.h
(e.g. input2[] test sequence from testra/crc_test
 decodes incorrectly to packed bits: 90 b0 3e 80 03 87 53 bd 6f 08,
 this patch fixes it)
2011-01-22 22:48:37 +01:00
Sylvain Munaut aeb1077051 bits: Add extended options version of pbit2ubit and ubit2pbit
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-01-21 12:22:30 +01:00
Harald Welte 2230c133a6 [BITS] introduce new packed/unpacked bit conversion routines 2011-01-19 10:10:16 +01:00