commit | 6862cd38a59685d15f9940fcf3882607081e3261 | [log] [tgz] |
---|---|---|
author | Neels Hofmeyr <neels@hofmeyr.de> | Sun Sep 13 23:56:21 2020 +0200 |
committer | laforge <laforge@osmocom.org> | Mon Sep 14 11:53:46 2020 +0000 |
tree | b05eb7f328c4fb5d0d4dc5e9aeb5553d12b3ba25 | |
parent | c0ac4e37c90149785b6fa77a59bb609a46474582 [diff] |
bitXXgen: add bitgen_test.c The autogenerated bitXXgen.h headers for osmo_load16le_ext() thru osmo_store64_be() are not actually tested at all. Add a test. The test output shows that the osmo_load*be_ext for a shorter len do not return nicely matching results. A practical example showing the difficulty in storing and loading 24bit integer values as/from big-endian: uint8_t buf[4]; memset(buf, 0, sizeof(buf)); osmo_store32be_ext(0x00112233, buf, 3); // stores 11 22 33 printf("%s\n", osmo_hexdump(buf, 4)); uint32_t r = osmo_load32be_ext(buf, 3); // returns 0x11223300, not 0x00112233 printf("0x%x\n", r); output is: 11 22 33 00 0x11223300 In contrast, the little-endian variant properly aligns the loaded bytes on the least significant octet: uint8_t buf[4]; memset(buf, 0, sizeof(buf)); osmo_store32le_ext(0x00112233, buf, 3); // stores 33 22 11 printf("%s\n", osmo_hexdump(buf, 4)); uint32_t r = osmo_load32le_ext(buf, 3); // returns 0x00112233 as expected printf("0x%x\n", r); output for le is: 33 22 11 00 0x112233 Change-Id: I5542ace54376a206aa8574812d4c742c86c293b4
This repository contains a set of C-language libraries that form the core infrastructure of many Osmocom Open Source Mobile Communications projects.
Historically, a lot of this code was developed as part of the OpenBSC project, but which are of a more generic nature and thus useful to (at least) other programs that we develop in the sphere of Free Software / Open Source mobile communications.
There is no clear scope of it. We simply move all shared code between the various Osmocom projects in this library to avoid code duplication.
The libosmocore.git repository build multiple libraries:
The official homepage of the project is https://osmocom.org/projects/libosmocore/wiki/Libosmocore
You can clone from the official libosmocore.git repository using
git clone git://git.osmocom.org/libosmocore.git
There is a cgit interface at http://git.osmocom.org/libosmocore/
Doxygen-generated API documentation is generated during the build process, but also available online for each of the sub-libraries at http://ftp.osmocom.org/api/latest/libosmocore/
Discussions related to libosmocore are happening on the openbsc@lists.osmocom.org mailing list, please see https://lists.osmocom.org/mailman/listinfo/openbsc for subscription options and the list archive.
Please observe the Osmocom Mailing List Rules when posting.
Our coding standards are described at https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards
We us a gerrit based patch submission/review process for managing contributions. Please see https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for more details
The current patch queue for libosmocore can be seen at https://gerrit.osmocom.org/#/q/project:libosmocore+status:open