Rev 1757 | Rev 1787 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1757 | Rev 1780 | ||
---|---|---|---|
Line 146... | Line 146... | ||
146 | return; |
146 | return; |
147 | } |
147 | } |
148 | dest[i-1] = '\0'; |
148 | dest[i-1] = '\0'; |
149 | } |
149 | } |
150 | 150 | ||
151 | /** Convert ascii representation to __native |
151 | /** Convert ascii representation to unative_t |
152 | * |
152 | * |
153 | * Supports 0x for hexa & 0 for octal notation. |
153 | * Supports 0x for hexa & 0 for octal notation. |
154 | * Does not check for overflows, does not support negative numbers |
154 | * Does not check for overflows, does not support negative numbers |
155 | * |
155 | * |
156 | * @param text Textual representation of number |
156 | * @param text Textual representation of number |
157 | * @return Converted number or 0 if no valid number ofund |
157 | * @return Converted number or 0 if no valid number ofund |
158 | */ |
158 | */ |
159 | __native atoi(const char *text) |
159 | unative_t atoi(const char *text) |
160 | { |
160 | { |
161 | int base = 10; |
161 | int base = 10; |
162 | __native result = 0; |
162 | unative_t result = 0; |
163 | 163 | ||
164 | if (text[0] == '0' && text[1] == 'x') { |
164 | if (text[0] == '0' && text[1] == 'x') { |
165 | base = 16; |
165 | base = 16; |
166 | text += 2; |
166 | text += 2; |
167 | } else if (text[0] == '0') |
167 | } else if (text[0] == '0') |