mt_del(mrb_state *mrb, mt_tbl *t, mrb_sym sym)
{
  size_t hash, pos, start;

  if (t == NULL) return FALSE;
  if (t->alloc == 0) return  FALSE;
  if (t->size == 0) return FALSE;

  hash = kh_int_hash_func(mrb, sym);
  start = pos = hash & (t->alloc-1);
  for (;;) {
    struct mt_elem *slot = &t->table[pos];

    if (slot->key == sym) {
      t->size--;
      slot->key = 0;
      slot->func_p = 1;
      return TRUE;
    }
    else if (slot_empty_p(slot)) {
      return FALSE;
    }
    pos = (pos+1) & (t->alloc-1);
    if (pos == start) {         /* not found */
      return FALSE;
    }
  }
}
mt_del(mrb_state *mrb, mt_tbl *t, mrb_sym sym)
{
  size_t hash, pos, start;

  if (t == NULL) return FALSE;
  if (t->alloc == 0) return  FALSE;
  if (t->size == 0) return FALSE;

  hash = kh_int_hash_func(mrb, sym);
  start = pos = hash & (t->alloc-1);
  for (;;) {
    struct mt_elem *slot = &t->table[pos];

    if (slot->key == sym) {
      t->size--;
      slot->key = 0;
      slot->func_p = 1;
      return TRUE;
    }
    else if (slot_empty_p(slot)) {
      return FALSE;
    }
    pos = (pos+1) & (t->alloc-1);
    if (pos == start) {          
      return FALSE;
    }
  }
}