int tree_function(BITMAP_TYPE bitmap, uint8_t stride) { #ifndef FAST_TREE_FUNCTION int i; int pos; if (bitmap == 0ULL) return -1; for(i=STRIDE-1;i>=0;i--){ stride >>= 1; pos = count_inl_bitmap(stride, i); if (test_bitmap(bitmap, pos)){ return pos; } } return -1; #else BITMAP_TYPE ret; int pos; ret = fct[(stride>>1)] & bitmap; if(ret){ pos = __builtin_clzll(ret); return 63 - pos; } else return -1; #endif }
int prefix_exist_func(struct mb_node *node, uint8_t stride, uint8_t pos, uint8_t type, void *data) { if(type == LEAF_NODE) { if (!(test_bitmap(node->internal , pos))) { return 0; } } else { if(!test_bitmap(node->external,pos)) { return 0; } } return TRAVERSE_CONT; }
NTSTATUS DriverEntry(PDRIVER_OBJECT driver, PUNICODE_STRING reg_path) { DbgPrint("bitmap: Hello, my salary!\r\n"); driver->DriverUnload = DriverUnload; test_bitmap(); return STATUS_SUCCESS; }
int main() { test_table(); test_rows(); test_bitmap(); test_int_key(); test_text_key(); test_cursor(); test_reference(); return 0; }
static void do_test() { test_bitmap(); test_dmfont(); test_realtime(); test_mm(); test_bezier(); test_ttf(); test_float(); test_keyboard(); }
int find_overlap_in_node(BITMAP_TYPE bitmap, uint8_t stride, uint8_t *mask, int limit_inside) { int i; int pos; if (bitmap == 0ULL) return -1; //calulate the beginning bits stride >>= (STRIDE - limit_inside); for(i=limit_inside-1;i>=0;i--){ stride >>= 1; *mask = i; pos = count_inl_bitmap(stride, i); if (test_bitmap(bitmap, pos)){ return pos; } } return -1; }
void mem_subtrie(struct mb_node_v6 *n, struct mem_stats_v6 *ms) { int stride; int pos; struct mb_node_v6 *next; int child_num = count_children(n->external); int rule_num = count_children(n->internal); ms->mem += (UP_RULE(rule_num) + UP_CHILD(child_num)) * NODE_SIZE; ms->node += (UP_RULE(rule_num) + UP_CHILD(child_num)); for (stride = 0; stride < (1<<STRIDE); stride ++ ){ pos = count_enl_bitmap(stride); if (test_bitmap(n->external, pos)) { next = (struct mb_node_v6 *)n->child_ptr + count_ones(n->external, pos); mem_subtrie(next, ms); } } }
int main(int argc, char **argv) { test_bitmap(); return 0; }
DEF_TEST(ShaderOpacity, reporter) { test_gradient(reporter); test_color(reporter); test_bitmap(reporter); }
void destroy_subtrie(struct mb_node_v6 *node, void (*destroy_nhi)(struct next_hop_info *nhi), struct mc *m, int depth, int use_mm) #endif { int bit; int cidr; int pos; struct next_hop_info ** nhi = NULL; int stride; struct mb_node_v6 *next = NULL; int cnt_rules; struct mb_node_v6 *first = NULL; for (cidr=0;cidr<= STRIDE -1;cidr ++ ){ for (bit=0;bit< (1<<cidr);bit++) { pos = count_inl_bitmap(bit,cidr); if (test_bitmap(node->internal, pos)) { nhi = (struct next_hop_info**)node->child_ptr - count_ones(node->internal, pos) - 1; if (destroy_nhi && *nhi != NULL) { destroy_nhi(*nhi); } *nhi = NULL; } } } for (stride = 0; stride < (1<<STRIDE); stride ++ ){ pos = count_enl_bitmap(stride); if (test_bitmap(node->external, pos)) { next = (struct mb_node_v6 *)node->child_ptr + count_ones(node->external, pos); #ifndef USE_MM destroy_subtrie(next, destroy_nhi); #else destroy_subtrie(next, destroy_nhi, m, depth + 1, use_mm); #endif } } cnt_rules = count_children(node->internal); first = POINT(node->child_ptr) - UP_RULE(cnt_rules); #ifdef DEBUG_MEMORY_FREE int cnt = count_children(node->internal); mem_destroy += UP_RULE(cnt) * NODE_SIZE; cnt = count_children(node->external); mem_destroy += UP_CHILD(cnt) * NODE_SIZE; #endif node->internal = 0; node->external = 0; node->child_ptr = NULL; #ifdef USE_MM //printf("not supported\n"); int cnt_children = count_children(node->external); free_node(m, first, UP_RULE(cnt_rules) + UP_CHILD(cnt_children), depth, use_mm); #else free(first); #endif }