File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,24 @@ void setup()
85
85
}
86
86
return ;
87
87
}
88
+ int hex_atoi (char * s )
89
+ {
90
+ int len = strlen (s ); int ans = 0 ;
91
+ for (int i = 0 ; i < len ; i ++ ){
92
+ int digital = 0 ; int pow_result = 1 ;
93
+ if (s [i ]> 47 && s [i ]< 58 ){
94
+ digital = s [i ] - 48 ;
95
+ }
96
+ else if (s [i ]> 96 && s [i ]< 103 ){
97
+ digital = s [i ] - 87 ;
98
+ }
99
+ for (int j = 0 ; j < i ; j ++ ){
100
+ pow_result *= 16 ;
101
+ }
102
+ ans += digital * pow_result ;
103
+ }
104
+ return ans ;
105
+ }
88
106
void init (char * pid_c )
89
107
{
90
108
char filename [32 ];
@@ -143,7 +161,7 @@ void init(char* pid_c)
143
161
}
144
162
end [end_p ] = '\0' ;
145
163
printf ("\033[44;33mstart:%s end:%s\033[0m\n" ,start , end );
146
- addr_start = atoi (start ); addr_end = atoi (end );
164
+ addr_start = hex_atoi (start ); addr_end = hex_atoi (end );
147
165
printf ("\033[44;33mstart:0x%08x end:0x%08x\033[0m\n" ,addr_start , addr_end );
148
166
}
149
167
}
You can’t perform that action at this time.
0 commit comments