Take the 2-minute tour ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

as an exercise problem in ARM assembly program, I had to convert a number x to its absolute value. now seeing the problem as a simple problem of removing the sign of the respective number, I used BIC instruction to clear the MSB sign bit. later on I found out that RSBMI instruction is present in ARM to compute the absolute value of any number.

my query is that what is the difference between these two methods employed, does BIC and RSBMI present any different result in some cases? or if it can be done by just BIC then why add an RSBMI in RISC instruction set?

share|improve this question
    
Your BIC would work if values were represented as sign-magnitude. Instead (nearly?) all computers use 2's-complement. –  Wouter van Ooijen Jul 20 at 9:37

1 Answer 1

up vote 3 down vote accepted

I had to convert a number x to its absolute value. now seeing the problem as a simple problem of removing the sign of the respective number

Which yields wrong results, of course. Example (in 8 Bit): -1 = 0xFF, sign bit set to zero: 0x7F => +127 instead of +1.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.