Exemplo n.º 1
0
/*
 * Print table
 */
static void print_pprod_table(FILE *f, pprod_table_t *table) {
  pprod_t *p;
  uint32_t i, n;
  int32_t l;

  fprintf(f, "pprod_table %p\n", table);
  fprintf(f, "  size = %"PRIu32"\n", table->size);
  fprintf(f, "  nelems = %"PRIu32"\n", table->nelems);
  fprintf(f, "  free_idx = %"PRId32"\n", table->free_idx);
  fprintf(f, "  content:\n");
  n = table->nelems;
  for (i=0; i<n; i++) {
    p = table->data[i];
    if (!has_int_tag(p)) {
      fprintf(f, "  data[%"PRIu32"] = ", i);
      print_varexp_array(f, p->prod, p->len);
      fprintf(f, "\n");
    }
  }
  if (table->free_idx >= 0) {
    fprintf(f, "  free list:");
    l = table->free_idx;
    do {
      fprintf(f, " %"PRId32, l);
      l = untag_i32(table->data[l]);
    } while (l >= 0);
    fprintf(f, "\n");
  }
}
Exemplo n.º 2
0
static void test_uint(uint32_t x) {
  void *p;

  printf("Test uint: x = %"PRIu32, x);
  p = tag_u32(x);
  printf(", tagged: %p, untagged: %"PRIu32, p, untag_u32(p));
  assert(has_int_tag(p));
  assert(untag_u32(p) == x);
  printf(": OK\n");
  fflush(stdout);
}
Exemplo n.º 3
0
static void test_ptr(void *x) {
  printf("Test pointer: x = %p", x);
  assert(!has_int_tag(x));
  printf(": OK\n");
  fflush(stdout);
}