I totally overlooked the wording in the spec that says least significant parts appear before more significant ones, and used the inverse convention.
This was discovered when I compared to Java output (highlighting the absence of the interoperability tests for c++!).
Here is a fix for the code. Interoperability tests should follow soon.