Determine the width of the character.
(b byte)
| 179 | |
| 180 | // Determine the width of the character. |
| 181 | func width(b byte) int { |
| 182 | // Don't replace these by a switch without first |
| 183 | // confirming that it is being inlined. |
| 184 | if b&0x80 == 0x00 { |
| 185 | return 1 |
| 186 | } |
| 187 | if b&0xE0 == 0xC0 { |
| 188 | return 2 |
| 189 | } |
| 190 | if b&0xF0 == 0xE0 { |
| 191 | return 3 |
| 192 | } |
| 193 | if b&0xF8 == 0xF0 { |
| 194 | return 4 |
| 195 | } |
| 196 | return 0 |
| 197 | |
| 198 | } |
no outgoing calls
no test coverage detected