Rev 585 | Rev 601 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 585 | Rev 591 | ||
---|---|---|---|
Line 133... | Line 133... | ||
133 | text += 2; |
133 | text += 2; |
134 | } else if (text[0] == '0') |
134 | } else if (text[0] == '0') |
135 | base = 8; |
135 | base = 8; |
136 | 136 | ||
137 | while (*text) { |
137 | while (*text) { |
138 | result *= base; |
- | |
139 | if (base != 16 && *text >= 'A' && *text <= 'F') |
138 | if (base != 16 && *text >= 'A' && *text <= 'F') |
140 | break; |
139 | break; |
141 | if (base == 8 && *text >='8') |
140 | if (base == 8 && *text >='8') |
142 | break; |
141 | break; |
143 | 142 | ||
144 | if (*text >= '0' && *text <= '9') |
143 | if (*text >= '0' && *text <= '9') { |
- | 144 | result *= base; |
|
145 | result += *text - '0'; |
145 | result += *text - '0'; |
146 | else if (*text >= 'A' && *text <= 'F') |
146 | } else if (*text >= 'A' && *text <= 'F') { |
- | 147 | result *= base; |
|
147 | result += *text - 'A' + 10; |
148 | result += *text - 'A' + 10; |
148 | else |
149 | } else |
149 | break; |
150 | break; |
150 | text++; |
151 | text++; |
151 | } |
152 | } |
152 | 153 | ||
153 | return result; |
154 | return result; |