apple-ouyang / gdelta

A delta compression algorithem better than Xdelta
https://ieeexplore.ieee.org/abstract/document/9229609/
MIT License
8 stars 5 forks source link

Bitwise portable issue #6

Open apple-ouyang opened 2 years ago

apple-ouyang commented 2 years ago

I found a stackoverflow post saying that the bitfield is not portable. The only portable code is using bit-wise operators. So should we change to bit-wise operators? @i404788

i404788 commented 2 years ago

It seems to be implementation-defined by the C standard although I believe it's consistent across the major compilers that support packed bitfields, I can do some tests for that. For little-endian machines a difference does need to be made (http://mjfrazer.org/mjfrazer/bitfields/), however that is also needed when using bit-wise operators (if the deltas are transferred across platforms).

i404788 commented 2 years ago

OSX:

To test:

apple-ouyang commented 2 years ago

I look forward to seeing your test results

i404788 commented 2 years ago

I've completed testing, with some minor changes it does work across all compilers listed above (check the msvc gobolt link for the final code). I'll create a pull request later