paulsengroup / hictk

Blazing fast toolkit to work with .hic and .cool files
MIT License
22 stars 1 forks source link

For the time being, refuse to build on big-endian architectures #181

Closed robomics closed 3 months ago

robomics commented 3 months ago

hictk itself can be built on both little and big-endian architectures. However, the hic library will be quite limited on big-endian archs. These are the current limitations:

The above limitations are due to the use of reinterpret_cast<> and raw std::fstream methods to serialize binary data to disk. The .hic file specification does not mandate the endianness that should be used to read and write .hic files, however virtually all .hic files are generated on little-endian machines, so the byte order of the serialized data is also little-endian, making little-endian the de-facto byte order standard.

It is my understanding that machines with big-endian architecture are not that common in desktop/HPC environments used for bioinformatics, so supporting big-endian architectures is likely not a pressing matter.

Supporting big-endian architecture can be achieved by manually converting binary types stored in BinaryBuffers to little-endian before casting them to char* for serialization. This can be achieved with the help of libraries such as Boost.Endian.

As this conversion is only needed on big-endian machines, extra care should be taken to ensure that the implementation of this feature does not add build nor runtime costs on little-endian machines (i.e. hictk should link to boost only on big-endian platforms and the code performing endianness conversion should be wrapped in if constexpr and/or disabled with std::enable_if as appropriate).

codecov-commenter commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 85.07%. Comparing base (9f426e7) to head (4dbdb21). Report is 21 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #181 +/- ## ========================================== + Coverage 84.91% 85.07% +0.16% ========================================== Files 119 120 +1 Lines 10076 10225 +149 ========================================== + Hits 8556 8699 +143 - Misses 1520 1526 +6 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.