Signed Binary annoying ?
Posted: Sat May 21, 2005 10:40 pm
Code updated For 5.20+
Convert signed binary to unsigned binary ( as long )
and for testing
Convert signed binary to unsigned binary ( as long )
Code: Select all
Procedure SignedBinaryToUnsigned(Byte.b)
If Byte & %10000000
Byte=Byte & %01111111
Retour=Byte+128
Else
Retour=Byte
EndIf
ProcedureReturn Retour
EndProcedure
Code: Select all
;/ Unsigned Signed
Debug SignedBinaryToUnsigned(%00000000) ; 0 0
Debug SignedBinaryToUnsigned(%01111111) ; 127 127
Debug SignedBinaryToUnsigned(%10000000) ; 128 -128
Debug SignedBinaryToUnsigned(%11111111) ; 255 -1