|
|
@ -54,10 +54,10 @@ char *to_string(int number) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
unsigned int powerOfTen(unsigned int n){ |
|
|
|
unsigned int power(unsigned int b, unsigned int n){ |
|
|
|
unsigned int result = 1, ctr = 0; |
|
|
|
while(ctr<n){ |
|
|
|
result *= 10; |
|
|
|
result *= b; |
|
|
|
++ctr; |
|
|
|
} |
|
|
|
return result; |
|
|
@ -68,7 +68,7 @@ unsigned int toUnsignedInteger(char *ID) |
|
|
|
unsigned int result = 0; |
|
|
|
int IDLength = strlen(ID); |
|
|
|
for(int i=0, j = IDLength - 1;i<IDLength;++i,--j){ |
|
|
|
result += (*(ID+j) - '0') * powerOfTen(i); |
|
|
|
result += (*(ID+j) - '0') * power(10,i); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|