| 3083 | } |
| 3084 | |
| 3085 | int rebuild_bitmap(const uint32_t *reposition, |
| 3086 | struct ewah_bitmap *source, |
| 3087 | struct bitmap *dest) |
| 3088 | { |
| 3089 | uint32_t pos = 0; |
| 3090 | struct ewah_iterator it; |
| 3091 | eword_t word; |
| 3092 | |
| 3093 | ewah_iterator_init(&it, source); |
| 3094 | |
| 3095 | while (ewah_iterator_next(&word, &it)) { |
| 3096 | uint32_t offset, bit_pos; |
| 3097 | |
| 3098 | for (offset = 0; offset < BITS_IN_EWORD; ++offset) { |
| 3099 | if ((word >> offset) == 0) |
| 3100 | break; |
| 3101 | |
| 3102 | offset += ewah_bit_ctz64(word >> offset); |
| 3103 | |
| 3104 | bit_pos = reposition[pos + offset]; |
| 3105 | if (bit_pos > 0) |
| 3106 | bitmap_set(dest, bit_pos - 1); |
| 3107 | else /* can't reuse, we don't have the object */ |
| 3108 | return -1; |
| 3109 | } |
| 3110 | |
| 3111 | pos += BITS_IN_EWORD; |
| 3112 | } |
| 3113 | return 0; |
| 3114 | } |
| 3115 | |
| 3116 | uint32_t *create_bitmap_mapping(struct bitmap_index *bitmap_git, |
| 3117 | struct packing_data *mapping) |
no test coverage detected