Questions regarding signed values in Tunerpro

Discuss anything TunerPro related.

Moderators: Mangus, robertisaar, dex

Post Reply
ericruhl
Posts: 30
Joined: Fri Dec 16, 2005 8:49 pm

Questions regarding signed values in Tunerpro

Post by ericruhl »

As I understand it, in signed binaries the first bit indicates whether the number is positive (0) or negative (1). For example, if using signed values the binary number 10100110 represents -38 and 00100110 = +38 (note: if not using signed values, 10100110 = 166).

What has me confused is that Tunerpro doesn't seem to work this way. If the binary value is 10100110 and I check the Signed checkbox in the item's xdf settings I get -90 instead of -38. 90 in binary is 01011010, so -90 should be 11011010. How is Tunerpro getting 11011010 out of 10100110?? I'll try to summarize below:

Signed binaries
10100110 = -38
00100110 = +38

Tunerpro
10100110 = 166 if "Signed" is unchecked, -90 if checked

What am I missing here???
User avatar
dex
The Ford Guy
Posts: 614
Joined: Thu Oct 07, 2004 6:38 am

Post by dex »

Whilst the high bit of a signed byte is used to signify whether the number is positive or negative it's not simply a case of toggling it to change the value from positive to negative and vice versa.

To convert a number to negative perform NOT and add 1
To convert a number to positive subtract 1 and perform NOT

Thus if you take your example of -38 this is 11011010 in binary and if you try this you'll see it works out :)
Post Reply