Beispiel #1
0
void ctw_update_context(ContextTree *tree) {
  if (tree->history->size < tree->depth) {
    perror("Not enough history to update context\n");
  }
  ctw_list_free(tree->context);
  tree->context = ctw_list_create();
  ctw_list_push(tree->context, tree->root);
  ContextTreeNode *node = tree->root;
  uint64_t update_depth = 1;
  uint64_t i;
  for (i = 0; i < tree->history->size; i++) {
    bool symbol = bv_test(tree->history, tree->history->size - i - 1);

    if (symbol && node->one_child != NULL) {
      node = node->one_child;
    } else if (!symbol && node->zero_child != NULL) {
      node = node->zero_child;
    } else {
      ContextTreeNode *new_node = ctw_node_create();
      if (symbol) {
        node->one_child = new_node;
      } else {
        node->zero_child = new_node;
      }
      node = new_node;
    }
    ctw_list_push(tree->context, node);
    update_depth += 1;
    if (update_depth > tree->depth) {
      break;
    }
  }
}
Beispiel #2
0
Datei: acl.c Projekt: nicboul/xia
int acl_set_create(const unsigned int set)
{
	journal_ftrace(__func__);

	/*
	 * acl set 0 is a special set initialized by acl_set_init()
	 */
	if (set > 0 && !bv_test(set, set_states, ACLSETSIZ)) {

		// sanitize
		journal_notice("---------failure is normal---------\n");
		mem_fun.set_destroy(set);
		journal_notice("-----------------------------------\n");

		if (mem_fun.set_create(set)) {
			// XXX - log_notice_msg does not work here ? */
			journal_notice("%s %u :: %s:%i\n",
				"unable to initialize acl set",
				set, __FILE__, __LINE__);
			return 1;
		}

		bv_set(set, set_states, ACLSETSIZ);
	}

	return 0;
}
Beispiel #3
0
void ctw_update_vector(ContextTree *tree, BitVector *symbols) {
  uint64_t i;
  for (i = 0; i < symbols->size; i++) {
    bool symbol = bv_test(symbols, i);
    ctw_update_symbol(tree, symbol);
  }
}
Beispiel #4
0
Datei: acl.c Projekt: nicboul/xia
void acl_fini()
{
	journal_ftrace(__func__);

	unsigned int i;

	for (i = 1; i < ACLSETSIZ; ++i)
		if (bv_test(i, set_states, ACLSETSIZ))
			mem_fun.set_destroy(i);

	mem_fun.set_fini();
}