CSE 230 Study Guide - Final Guide: Inline-Four Engine, Exclusive Or, C Data Types

35 views8 pages

Document Summary

2"s complement notation: positive values have 0 in left-most bit, to negate a positive value, complement ( flip ) each bit and then add 1 to the result. (negative values have 1 in the left-most bit. , example: Bitwise operators bitwise complement (1"s complement) bitwise and bitwise or bitwise xor (exclusive or) left shift right shift. = 0x5678, c = 0x9abc; short int printf( %x\n%x\n%x\n%x\n%x\n , ~a, a & b, a | b, a ^ b, a & b | c); Shift operators short int unsigned short printf( %x\n%x\n%x\n%x\n , a = 0x1234, Masking: the bitwise-and operator is often used to mask out specific bits of an integer value, example: int is_odd(int num) int mask = _______; return (________________); } data compression: bitwise operators can be used to pack data and unpack data, pack - store small data units in large unit, unpack - extract small data units from large unit.

Get access

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

Related Documents