client9 / stringencoders

Fast c-string transformations
MIT License
135 stars 51 forks source link

Fix modp_uitoa16 for big-endian #47

Closed Deni90 closed 8 years ago

Deni90 commented 8 years ago

modp_numtoa_test failed on mips (big-endian) with the following message: modp_numtoa_test.c ............ASSERTION FAILED: modp_numtoa_test.c:495 10000000 != 00000001

There is no need to separate the code for big and little endian. The bitwise operators abstract away the endianness. The >> operator always shifts the bits towards the least significant digit. Endianness matters when dealing with individual bytes in a larger structure.

I have tested this PR successfully on mips, mipsel and i386.

client9 commented 8 years ago

wow thanks so much!