flat assembler
Message board for the users of flat assembler.

Index > Non-x86 architectures > [ARM] 64 bit two's compliment

Author
Thread Post new topic Reply to topic
cwpjr



Joined: 03 Jul 2012
Posts: 44
cwpjr 27 Oct 2012, 23:03
I am sorry to bother you folks with my problem. That said I am trying to figure out in THUMB2 code how to take MSW LSW 64 bit double word ( say in r1 and r2 ) value that could be signed or not and convert the whole shebang to a double number two's complement of the original value.

Baring puppy love in code an explanation of the logic would be fine...

Thanks, Clyde

_________________
Developing ARM Electronic Hobby Bench Stuff!
Post 27 Oct 2012, 23:03
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20300
Location: In your JS exploiting you and your system
revolution 28 Oct 2012, 00:20
The most common way to do extended two's complement is negate and add 1:
Code:
mvn  r1,r1
mvn  r2,r2
adds r1,r1,1
adc  r2,r2,0    
Post 28 Oct 2012, 00:20
View user's profile Send private message Visit poster's website Reply with quote
cwpjr



Joined: 03 Jul 2012
Posts: 44
cwpjr 28 Oct 2012, 00:59
Thank Revolution. I still haven't forgotten your challenge of x86 translation but I am not up to te task yet!
Post 28 Oct 2012, 00:59
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.