uint32_t index1 = wc >> (t->q + t->p); uint32_t index2 = (wc >> t->p) & ((1 << t->q) - 1); uint32_t index3 = wc & ((1 << t->p) - 1); int32_t value; size_t i, i1, i2;  if (mapped_wc == wctrans_table_get (t, wc)) return;  value = (int32_t) mapped_wc - (int32_t) wc;  if (index1 >= t->level1_size) { if (index1 >= t->level1_alloc) { size_t alloc = 2 * t->level1_alloc; if (alloc <= index1) alloc = index1 + 1; t->level1 = (t->level1_alloc > 0 ? (uint32_t *) xrealloc ((char *) t->level1, alloc * sizeof (uint32_t)) : (uint32_t *) xmalloc (alloc * sizeof (uint32_t))); t->level1_alloc = alloc; } while (index1 >= t->level1_size) t->level1[t->level1_size++] = ~((uint32_t) 0); }  if (t->level1[index1] == ~((uint32_t) 0)) { if (t->level2_size == t->level2_alloc) { size_t alloc = 2 * t->level2_alloc + 1; t->level2 = (t->level2_alloc > 0 ? (uint32_t *) xrealloc ((char *) t->level2, (alloc << t->q) * sizeof (uint32_t)) : (uint32_t *) xmalloc ((alloc << t->q) * sizeof (uint32_t))); t->level2_alloc = alloc; } i1 = t->level2_size << t->q; i2 = (t->level2_size + 1) << t->q; for (i = i1; i < i2; i++) t->level2[i] = ~((uint32_t) 0); t->level1[index1] = t->level2_size++; }  index2 += t->level1[index1] << t->q;  if (t->level2[index2] == ~((uint32_t) 0)) { if (t->level3_size == t->level3_alloc) { size_t alloc = 2 * t->level3_alloc + 1; t->level3 = (t->level3_alloc > 0 ? (int32_t *) xrealloc ((char *) t->level3, (alloc << t->p) * sizeof (int32_t)) : (int32_t *) xmalloc ((alloc << t->p) * sizeof (int32_t))); t->level3_alloc = alloc; } i1 = t->level3_size << t->p; i2 = (t->level3_size + 1) << t->p; for (i = i1; i < i2; i++) t->level3[i] = 0; t->level2[index2] = t->level3_size++; }  index3 += t->level2[index2] << t->p;  t->level3[index3] = value;
wctrans_table_add_internal (t, wc, mapped_wc - wc);
wctrans_table_add (struct wctrans_table *t, uint32_t wc, uint32_t mapped_wc){  uint32_t index1 = wc >> (t->q + t->p);  uint32_t index2 = (wc >> t->p) & ((1 << t->q) - 1);  uint32_t index3 = wc & ((1 << t->p) - 1);  int32_t value;  size_t i, i1, i2;  if (mapped_wc == wctrans_table_get (t, wc))    return;  value = (int32_t) mapped_wc - (int32_t) wc;  if (index1 >= t->level1_size)    {      if (index1 >= t->level1_alloc)	{	  size_t alloc = 2 * t->level1_alloc;	  if (alloc <= index1)	    alloc = index1 + 1;	  t->level1 = (t->level1_alloc > 0		       ? (uint32_t *) xrealloc ((char *) t->level1,						alloc * sizeof (uint32_t))		       : (uint32_t *) xmalloc (alloc * sizeof (uint32_t)));	  t->level1_alloc = alloc;	}      while (index1 >= t->level1_size)	t->level1[t->level1_size++] = ~((uint32_t) 0);    }  if (t->level1[index1] == ~((uint32_t) 0))    {      if (t->level2_size == t->level2_alloc)	{	  size_t alloc = 2 * t->level2_alloc + 1;	  t->level2 = (t->level2_alloc > 0		       ? (uint32_t *) xrealloc ((char *) t->level2,						(alloc << t->q) * sizeof (uint32_t))		       : (uint32_t *) xmalloc ((alloc << t->q) * sizeof (uint32_t)));	  t->level2_alloc = alloc;	}      i1 = t->level2_size << t->q;      i2 = (t->level2_size + 1) << t->q;      for (i = i1; i < i2; i++)	t->level2[i] = ~((uint32_t) 0);      t->level1[index1] = t->level2_size++;    }  index2 += t->level1[index1] << t->q;  if (t->level2[index2] == ~((uint32_t) 0))    {      if (t->level3_size == t->level3_alloc)	{	  size_t alloc = 2 * t->level3_alloc + 1;	  t->level3 = (t->level3_alloc > 0		       ? (int32_t *) xrealloc ((char *) t->level3,					       (alloc << t->p) * sizeof (int32_t))		       : (int32_t *) xmalloc ((alloc << t->p) * sizeof (int32_t)));	  t->level3_alloc = alloc;	}      i1 = t->level3_size << t->p;      i2 = (t->level3_size + 1) << t->p;      for (i = i1; i < i2; i++)	t->level3[i] = 0;      t->level2[index2] = t->level3_size++;    }  index3 += t->level2[index2] << t->p;  t->level3[index3] = value;}