COMPSCI 61C Lecture Notes - Lecture 9: Program Counter, C Dynamic Memory Allocation

49 views4 pages

Document Summary

Useful to operate on elds of bits within a word (e. g. characters within a word 8 bits) Operations to pack / unpack bits into words. Logical shifting shift left: multiplication by 2^n shift right: division by 2^n sometimes fails for odd negative numbers. C arithmetic semantics is that division should round towards 0. Mips if statement beq register(cid:616), register(cid:617), l(cid:616) if (value in register1) == (value in register2): do l1 beq : branch if equal bne : branch not equal . Types of branches branch: change of control ow conditional branch: change control ow depending on outcome of comparison beq : branch if equal bne : branch if not equal unconditional branch: always branch (mips instruction: jump(cid:383)j(cid:384) ) Set on less than slt reg(cid:616), reg(cid:617), reg(cid:618) if (reg2 < reg3) reg1 = 1 else reg1 = 0; slti : immediate version of slt to test against constants.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents