| 4362 | } |
| 4363 | |
| 4364 | static __attribute__((__noinline__)) bool scanf_get_hex( |
| 4365 | struct scanf_stream_s *in, size_t *width, uint64_t *p, bool *r) |
| 4366 | { |
| 4367 | char c = scanf_get_char_n(in, width); |
| 4368 | if (!isxdigit(c)) |
| 4369 | { |
| 4370 | scanf_unget_char_n(c, in, width); |
| 4371 | return false; |
| 4372 | } |
| 4373 | uint64_t i = 0; |
| 4374 | do |
| 4375 | { |
| 4376 | i *= 16; |
| 4377 | uint64_t d = (c >= '0' && c <= '9'? c - '0': |
| 4378 | c >= 'a' && c <= 'f'? 10 + c - 'a': |
| 4379 | c >= 'A' && c <= 'F'? 10 + c - 'A': 0); |
| 4380 | if (UINT64_MAX - i < d) |
| 4381 | *r = true; |
| 4382 | i = (UINT64_MAX - i < d? UINT64_MAX: i + d); |
| 4383 | } |
| 4384 | while (isxdigit(c = scanf_get_char_n(in, width))); |
| 4385 | scanf_unget_char_n(c, in, width); |
| 4386 | *p = i; |
| 4387 | return true; |
| 4388 | } |
| 4389 | |
| 4390 | static __attribute__((__noinline__)) bool scanf_get_num( |
| 4391 | struct scanf_stream_s *in, size_t width, unsigned flags, void *ptr) |
no test coverage detected