| 39 | */ |
| 40 | |
| 41 | char* itoa(int value,char* result,int base) { |
| 42 | |
| 43 | char* ptr=result,*ptr1=result,tmp_char; |
| 44 | int tmp_value; |
| 45 | |
| 46 | do { |
| 47 | tmp_value=value; |
| 48 | value/=base; |
| 49 | *ptr++="zyxwvutsrqponmlkjihgfedcba9876543210123456789abcdefghijklmnopqrstuvwxyz"[35+(tmp_value-value*base)]; |
| 50 | } while(value); |
| 51 | |
| 52 | // Apply negative sign |
| 53 | |
| 54 | if(tmp_value<0) |
| 55 | *ptr++='-'; |
| 56 | |
| 57 | *ptr--='\0'; |
| 58 | |
| 59 | while(ptr1<ptr) { |
| 60 | tmp_char=*ptr; |
| 61 | *ptr--=*ptr1; |
| 62 | *ptr1++=tmp_char; |
| 63 | } |
| 64 | return result; |
| 65 | } |
| 66 | |
| 67 | |
| 68 | /* |
no outgoing calls
no test coverage detected