ccurl icon indicating copy to clipboard operation
ccurl copied to clipboard

Trits signed char (ARM Compatibility Change)

Open maeck70 opened this issue 6 years ago • 0 comments

Fix to issue #39.

Before this PR, the code does not compile correctly on ARM due to a difference in CHAR implementation between x86 and ARM. x86 implementation treat CHAR as SIGNED CHAR, whereas ARM treats CHAR as UNSIGNED CHAR. Note that there isn't a standard for C how CHARs are signed or unsigned.

This difference in C spec results in unexpected results on ARM. The code multiplies by Trite which on x86 is [-1, 0 or 1] and on ARM [255, 0 or 1] which results in copying data from incorrect memory locations.

To make the code portable it is essential that all Trits are defined as SIGNED CHAR. Secondly Trytes on the other hand should be UNSIGNED CHARS "ABCDEF..XYZ9". There is no math done with Trytes so this is no as big of an issue as Trits.

maeck70 avatar Mar 22 '18 03:03 maeck70