| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/coreutils/src/gnulib/lib/memchr2.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||
| 8 | void * | - | ||||||||||||||||||||||||
| 9 | memchr2 (void const *s, int c1_in, int c2_in, size_t n) | - | ||||||||||||||||||||||||
| 10 | { | - | ||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||
| 12 | - | |||||||||||||||||||||||||
| 13 | - | |||||||||||||||||||||||||
| 14 | - | |||||||||||||||||||||||||
| 15 | - | |||||||||||||||||||||||||
| 16 | typedef unsigned long int longword; | - | ||||||||||||||||||||||||
| 17 | - | |||||||||||||||||||||||||
| 18 | const unsigned char *char_ptr; | - | ||||||||||||||||||||||||
| 19 | void const *void_ptr; | - | ||||||||||||||||||||||||
| 20 | const longword *longword_ptr; | - | ||||||||||||||||||||||||
| 21 | longword repeated_one; | - | ||||||||||||||||||||||||
| 22 | longword repeated_c1; | - | ||||||||||||||||||||||||
| 23 | longword repeated_c2; | - | ||||||||||||||||||||||||
| 24 | unsigned char c1; | - | ||||||||||||||||||||||||
| 25 | unsigned char c2; | - | ||||||||||||||||||||||||
| 26 | - | |||||||||||||||||||||||||
| 27 | c1 = (unsigned char) c1_in; | - | ||||||||||||||||||||||||
| 28 | c2 = (unsigned char) c2_in; | - | ||||||||||||||||||||||||
| 29 | - | |||||||||||||||||||||||||
| 30 | if (c1 == c2
| 15-95 | ||||||||||||||||||||||||
| 31 | return executed 15 times by 1 test: memchr (s, c1, n);return memchr (s, c1, n);Executed by:
executed 15 times by 1 test: return memchr (s, c1, n);Executed by:
| 15 | ||||||||||||||||||||||||
| 32 | - | |||||||||||||||||||||||||
| 33 | - | |||||||||||||||||||||||||
| 34 | - | |||||||||||||||||||||||||
| 35 | for (void_ptr = s; | - | ||||||||||||||||||||||||
| 36 | n > 0
| 3-119 | ||||||||||||||||||||||||
| 37 | --n) | - | ||||||||||||||||||||||||
| 38 | { | - | ||||||||||||||||||||||||
| 39 | char_ptr = void_ptr; | - | ||||||||||||||||||||||||
| 40 | if (*
| 0-27 | ||||||||||||||||||||||||
| 41 | return executed 24 times by 1 test: (void *) void_ptr;return (void *) void_ptr;Executed by:
executed 24 times by 1 test: return (void *) void_ptr;Executed by:
| 24 | ||||||||||||||||||||||||
| 42 | void_ptr = char_ptr + 1; | - | ||||||||||||||||||||||||
| 43 | } executed 27 times by 1 test: end of blockExecuted by:
| 27 | ||||||||||||||||||||||||
| 44 | - | |||||||||||||||||||||||||
| 45 | longword_ptr = void_ptr; | - | ||||||||||||||||||||||||
| 46 | repeated_one = 0x01010101; | - | ||||||||||||||||||||||||
| 47 | repeated_c1 = c1 | (c1 << 8); | - | ||||||||||||||||||||||||
| 48 | repeated_c2 = c2 | (c2 << 8); | - | ||||||||||||||||||||||||
| 49 | repeated_c1 |= repeated_c1 << 16; | - | ||||||||||||||||||||||||
| 50 | repeated_c2 |= repeated_c2 << 16; | - | ||||||||||||||||||||||||
| 51 | if (0xffffffffU < (longword) -1
| 0-71 | ||||||||||||||||||||||||
| 52 | { | - | ||||||||||||||||||||||||
| 53 | repeated_one |= repeated_one << 31 << 1; | - | ||||||||||||||||||||||||
| 54 | repeated_c1 |= repeated_c1 << 31 << 1; | - | ||||||||||||||||||||||||
| 55 | repeated_c2 |= repeated_c2 << 31 << 1; | - | ||||||||||||||||||||||||
| 56 | if (8 < sizeof (longword)
| 0-71 | ||||||||||||||||||||||||
| 57 | { | - | ||||||||||||||||||||||||
| 58 | size_t i; | - | ||||||||||||||||||||||||
| 59 | - | |||||||||||||||||||||||||
| 60 | for (i = 64; i < sizeof (longword) * 8
| 0 | ||||||||||||||||||||||||
| 61 | { | - | ||||||||||||||||||||||||
| 62 | repeated_one |= repeated_one << i; | - | ||||||||||||||||||||||||
| 63 | repeated_c1 |= repeated_c1 << i; | - | ||||||||||||||||||||||||
| 64 | repeated_c2 |= repeated_c2 << i; | - | ||||||||||||||||||||||||
| 65 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 66 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 67 | } executed 71 times by 1 test: end of blockExecuted by:
| 71 | ||||||||||||||||||||||||
| 68 | while (n >= sizeof (longword)
| 9-62 | ||||||||||||||||||||||||
| 69 | { | - | ||||||||||||||||||||||||
| 70 | longword longword1 = *longword_ptr ^ repeated_c1; | - | ||||||||||||||||||||||||
| 71 | longword longword2 = *longword_ptr ^ repeated_c2; | - | ||||||||||||||||||||||||
| 72 | - | |||||||||||||||||||||||||
| 73 | if (((((
| 0-9 | ||||||||||||||||||||||||
| 74 | | ((longword2 - repeated_one) & ~longword2))
| 0-9 | ||||||||||||||||||||||||
| 75 | & (repeated_one << 7)) != 0
| 0-9 | ||||||||||||||||||||||||
| 76 | break; executed 9 times by 1 test: break;Executed by:
| 9 | ||||||||||||||||||||||||
| 77 | longword_ptr++; | - | ||||||||||||||||||||||||
| 78 | n -= sizeof (longword); | - | ||||||||||||||||||||||||
| 79 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 80 | - | |||||||||||||||||||||||||
| 81 | char_ptr = (const unsigned char *) longword_ptr; | - | ||||||||||||||||||||||||
| 82 | for (; n > 0
| 5-122 | ||||||||||||||||||||||||
| 83 | { | - | ||||||||||||||||||||||||
| 84 | if (*
| 3-63 | ||||||||||||||||||||||||
| 85 | return executed 66 times by 1 test: (void *) char_ptr;return (void *) char_ptr;Executed by:
executed 66 times by 1 test: return (void *) char_ptr;Executed by:
| 66 | ||||||||||||||||||||||||
| 86 | } executed 56 times by 1 test: end of blockExecuted by:
| 56 | ||||||||||||||||||||||||
| 87 | - | |||||||||||||||||||||||||
| 88 | return executed 5 times by 1 test: return ((void *)0) ;Executed by:
executed 5 times by 1 test: return ((void *)0) ;Executed by:
| 5 | ||||||||||||||||||||||||
| 89 | ((void *)0) executed 5 times by 1 test: return ((void *)0) ;Executed by:
| 5 | ||||||||||||||||||||||||
| 90 | ; executed 5 times by 1 test: return ((void *)0) ;Executed by:
| 5 | ||||||||||||||||||||||||
| 91 | } | - | ||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |