## Computer Science 237 |

**Lecture 4: Logical Operators, Binary Arithmetic, Signed Representations****Date: September 16, 2005**

- Lab continues - ask questions when stuck
- In order to use the turnin command, your cs237 directory will
need to have world execute permission:
`chmod 711 cs237`This allows turnin to change into your directory to be able to copy out the files.

Alternately, you can copy the files you wish to submit out to your home directory or other more public area, turn them in, then remove them.

- In order to use the turnin command, your cs237 directory will
need to have world execute permission:
- Computer Science Colloquium today - CS Students talk about their summer work experiences

- Math
- signed addition
- 2's complement - OK if carry out == carry in for sign bit
- 1's complement - need to add any carry out back in

- signed multiplication
- 2's complement only - need sign extension, then OK
- powers of 2 - bit shifts!

- signed addition
- C logical operators
- Traditional logical operators: (
`==`

,`!`

,`!=`

,`&&`

,`||`

) - note short-circuit evaluation - Bitwise operators:
- bitwise AND (
`&`

) - result true when both operands true - bitwise OR (
`|`

) - result true when either operand true - bitwise XOR (
`^`

) - result true when exactly one operand true - bitwise complement (
`~`

) - result true when operand false - Addition (
`+`

)*vs.*bitwise XOR (`^`

). - Bitwise shift by n (
`x>>n`

or`x<<n`

)

- bitwise AND (

- Traditional logical operators: (

- shiftyproduct