Computer Science 2208A/B Lecture Notes - Lecture 10: Branch Table, Code-Switching, Cengage Learning

117 views9 pages

Document Summary

Example: calculating the absolute value (cid:137) to calculate x (cid:312) |x|, where x is a signed integer, we can implement if x < 0 then x = -x (cid:137) in arm. Example: byte manipulation and concatenation (cid:137) suppose we have r0, r1, and r2 as follow: r0 r1 r2 and we want to rearrange r2 as follow: r2 (cid:137) bic r0,r0,#0xffffff00. Add r2,r1,r2,lsl#16 ;lsl r2 by 2 bytes & add r1 to it. Add r2,r2,r0,lsl#8 ;lsl r0 by 1 byte & add it to r2. Mov r2,r2,ror#16 ;swap the two r2 16 bits together. Example: byte manipulation and concatenation (cid:206) (cid:137) bic r0,r0,#0xffffff00. Add r2,r1,r2,lsl#16 ;lsl r2 by 2 bytes & add r1 to it (cid:206) Add r2,r2,r0,lsl#8 ;lsl r0 by 1 byte & add it to r2 (cid:206) Mov r2,r2,ror#16 ;swap the two r2 16 bits together (cid:206) The assembler will uses a mov or mvn (if it can).

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents