File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: 2f3201a64c43762052bc13022ddb5695c11ea516
2
+ refs/heads/master: 11e747fc5835680ba2a78b3cbc277f93e07362a4
Original file line number Diff line number Diff line change @@ -210,18 +210,18 @@ fn hex_digit_val(char c) -> int {
210
210
}
211
211
212
212
if ( in_range ( c, 'a' , 'f' ) ) {
213
- ret ( c as int ) - ( 'a' as int ) ;
213
+ ret ( ( c as int ) - ( 'a' as int ) ) + 10 ;
214
214
}
215
215
216
216
if ( in_range ( c, 'A' , 'F' ) ) {
217
- ret ( c as int ) - ( 'A' as int ) ;
217
+ ret ( ( c as int ) - ( 'A' as int ) ) + 10 ;
218
218
}
219
219
220
220
fail;
221
221
}
222
222
223
223
fn bin_digit_value ( char c) -> int {
224
- if ( c == 0 ) { ret 0 ; }
224
+ if ( c == '0' ) { ret 0 ; }
225
225
ret 1 ;
226
226
}
227
227
@@ -281,7 +281,7 @@ fn next_token(reader rdr) -> token.token {
281
281
c = rdr. curr ( ) ;
282
282
while ( is_hex_digit ( c) || c == '_' ) {
283
283
accum_int *= 16 ;
284
- accum_int += hex_digit_val ( v ) ;
284
+ accum_int += hex_digit_val ( c ) ;
285
285
rdr. bump ( ) ;
286
286
c = rdr. curr ( ) ;
287
287
}
@@ -291,17 +291,17 @@ fn next_token(reader rdr) -> token.token {
291
291
rdr. bump ( ) ;
292
292
rdr. bump ( ) ;
293
293
c = rdr. curr ( ) ;
294
- while ( is_hex_digit ( c) || c == '_' ) {
294
+ while ( is_bin_digit ( c) || c == '_' ) {
295
295
accum_int *= 2 ;
296
- accum_int += bit_value ( c) ;
296
+ accum_int += bin_digit_value ( c) ;
297
297
rdr. bump ( ) ;
298
298
c = rdr. curr ( ) ;
299
299
}
300
300
}
301
301
302
302
while ( is_dec_digit ( c) || c == '_' ) {
303
303
accum_int *= 10 ;
304
- accum_int += dec_digit_val ( v ) ;
304
+ accum_int += dec_digit_val ( c ) ;
305
305
rdr. bump ( ) ;
306
306
c = rdr. curr ( ) ;
307
307
}
You can’t perform that action at this time.
0 commit comments