Closed cchayden closed 6 years ago
The alternative being to preserve the ABI and discard the last 17 bits, since they're officially unused, documenting the behaviour.
I prefer your solution as it seems obviously the Right Thing, and I always link libais statically in deployments, so it wouldn't cause a problem in practice to me at least. Not sure about other people though.
This seems mostly the same as #148.
@cchayden , Thanks! This PR is an improvement over #148 by initializing spare2. Can you please merge in 65cb1b12d65ebab97a34f4e54daaae81eab4b949 and then I'll merge this pull request. After that, I'll merge in the test I just added.
@himikof Thanks for reminding me of #148
The bitset ToUnsignedInt can handle up to 32 bits at a time: its second argument cannot be larger than 32. In processing ais6.cpp, in Ais6_1_5 ToUnsignedInt is called with a length argument greater than 32, causing a core dump.
This change breaks the reading of the spare bits into two chunks, so as not to exceed 32 bits.