int main() { struct foo { char dummy[3]; int gnu:4; unsigned absurd:7; /* across storage unit boundary */ char bleh; } f; f.dummy[0] = 1; f.dummy[1] = 2; f.dummy[2] = 3; f.gnu = 4; f.absurd = 0x7f; f.bleh = 6; printf("%d %d %d\n", f.dummy[0], f.dummy[1], f.dummy[2]); printf("%d\n", f.gnu); printf("%d\n", f.absurd); printf("%d\n", f.bleh); { printf("locations:\n"); memset(&f, 0, sizeof f); f.gnu = 0xf; printf("%d ", find_loc(&f, sizeof f)); memset(&f, 0, sizeof f); f.absurd = 0x7f; printf("%d\n", find_loc(&f, sizeof f)); } return 0; }
int ac_create() { int base = 0; int cur = 1; int tmp = 0; char c_tmp = 0; int i,j; p_node p; p_node pc; while (1) { if (tmp == cur) break; tmp = cur; if (tmp > status_count) break; for (i = base; i < tmp; i++) { p = status[i]; c_tmp = node_get_min_child_c(p); if (c_tmp == 0 || c_tmp == 127) continue; j = find_loc(p, c_tmp); ac_base[i] = j - c_tmp; pc = p->child; while (pc) { cur++; ac_next[(char)(ac_base[i] + pc->character)] = ac_get_status_index(pc); ac_check[ac_get_status_index(pc)] = i; pc = pc->next; } } base = tmp; } }