## 4-Bit Substring Pattern Replacement

• 4-bit substrings of 0's and 1's are replaced with single characters
• the character used for any specific 4-bit substring is based on the value of the substring if treated as an unsigned binary encoded number
• values of 0 through 9 use their respective digits as hexadecimal shorthand symbols
• values of 10 through 15 use the alphabetic symbols A through F respectively (10=A; 11=B; 12=C; 13=D; 14=E; 15=F)

### Dividing Bit Strings with Non-Multiple of 4 Lengths

• Start division of the string from the right end
• Pad with leading zeros (on the left)

## Arithmetic in Hexadecimal

• Decimal - Hexadecimal Conversions
• Hexadecimal as a Positional Notation
• Positional Weights for Hexadecimal Notation
 (etc.) (16*16*16) = 4096 (16*16) = 256 16 1
• Example, 5050 (decimal) expressed in hexadecimal
• = 1(4096) + 954
• = 1(4096) + 3(256) + 186
• = 1(4096) + 3(256) + 11(16) + 10
• = 13BA (hexadecimal) ...remembering that B is the symbol for 11 and A is the symbol for 10
• in decimal addition and subtraction, carries to or borrows from the next column are always worth 10 of the current column
• in hexadecimal addition and subtraction, carries to or borrows from the next column are always worth 16 of the current column
• Sample (Partial) Addition
 .. 3 7 9 + 5 E (=14) C (=12) (+ Carry In) .. (+1) (-16) Result .. .. 5

• Sample (Partial) Subtraction
 .. B (=11) F (=15) 3 -.. 6 9 D (=13) (Borrow from) .. (-1) (+16) Result .. .. 6

• 2's Complement Encoding in Hexadecimal
• The "subtraction from 0 method" is the simplest form for converting a hexadecimal encoded value into its negative form
• For example, -(04E7) in 2's Complement
 .. .. 0 0 0 0 -.. .. 0 4 E (=14) 7 Borrow from (-1) ignored (-1)(+16) (-1)(+16) (-1)(+16) (=16) Result .. F (=15) B (=11) 1 9