That is correct for converting a +ve to a -ve number. Does your compiler have the functions ishft, iand, ior
Code:
! ,-- move bottom 8 bits to the top
! | ,-- move top 8 bits to the bottom
y = ior(ishft(iand(x, 255), 8), ishft(x, -8))
!
! print numbers in hex to ensure byteswap
print '(I6, 1X, Z4, 1X, I6, 1X, Z4)', x, x, y, y
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.