Modularizando o src
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
Diff: utils.cpp
- Revision:
- 121:ee02790d00b7
- Parent:
- 119:ee6a53069455
- Child:
- 122:480c44b0e205
diff -r 770f00554b1e -r ee02790d00b7 utils.cpp --- a/utils.cpp Mon May 04 17:25:29 2015 +0000 +++ b/utils.cpp Fri May 08 04:15:23 2015 +0000 @@ -1,4 +1,4 @@ -#include "utils.h" +#include "header_app_includes.h" static char itoh[16]; char hexbuf[10]; @@ -29,43 +29,6 @@ int ls_comp( const void * a, const void * b ){ return( *( int * )a - *( int * )b ); } -void reverse( char str[], int length ){ - int start = 0; - int end = length -1; - while (start < end){ - swap(*(str+start), *(str+end)); - start++; - end--; - } -} -char* itoa(int num, char* str, int base){ - int i = 0; - bool isNegative = false; - - if( num == 0 ){ - str[i++] = '0'; - str[i] = '\0'; - return str; - } - if( num < 0 //&& base == 10 - ){ - isNegative = true; - num = -num; - } - while( num != 0 ){ - int rem = num % base; - str[i++] = (rem > 9)? (rem-10) + 'a' : rem + '0'; - num = num/base; - } - if( isNegative ) - str[i++] = '-'; - - str[i] = '\0'; // Append string terminator - - reverse( str, i ); - return( str ); -} - int convert_ext_to_port( int ext ){ if( ext < 1000 ) return ext;