Lines Matching refs:state
76 struct state {
84 assign_nodes(struct state *state)
90 for (i = 0; i < state->graph.e; ++i) {
91 e_idx = state->graph.output_order[i];
92 e = &state->graph.edges[e_idx];
93 if (!state->visited[e->vertices[0]]) {
97 } else if (!state->visited[e->vertices[1]]) {
106 g = e_idx - state->g[v1] - state->g[v2];
107 if (g >= state->graph.e) {
108 g += state->graph.e;
109 if (g >= state->graph.e)
110 g += state->graph.e;
112 state->g[v0] = g;
113 state->visited[v0] = 1;
114 state->visited[v1] = 1;
115 state->visited[v2] = 1;
120 assign_nodes(struct state *state)
126 for (i = 0; i < state->graph.e; ++i) {
127 e_idx = state->graph.output_order[i];
128 e = &state->graph.edges[e_idx];
129 if (!state->visited[e->vertices[0]]) {
136 g = e_idx - state->g[v1];
137 if (g >= state->graph.e)
138 g += state->graph.e;
139 state->g[v0] = g;
140 state->visited[v0] = 1;
141 state->visited[v1] = 1;
147 print_hash(struct nbperf *nbperf, struct state *state)
161 if (state->graph.v >= 65536) {
165 } else if (state->graph.v >= 256) {
175 g_type, state->graph.v);
176 for (i = 0; i < state->graph.v; ++i) {
179 g_width, state->g[i],
190 state->graph.v);
192 state->graph.v);
195 state->graph.v);
198 if (state->graph.hash_fudge & 1)
202 if (state->graph.hash_fudge & 2) {
212 "%" PRIu32 ";\n", state->graph.e);
215 "%" PRIu32 ";\n", state->graph.e);
220 for (i = 0; i < state->graph.e; ++i)
232 struct state state;
273 state.g = calloc(sizeof(uint32_t), v);
274 state.visited = calloc(sizeof(uint8_t), v);
275 if (state.g == NULL || state.visited == NULL)
278 SIZED2(_setup)(&state.graph, v, e);
279 if (SIZED2(_hash)(nbperf, &state.graph))
281 if (SIZED2(_output_order)(&state.graph))
283 assign_nodes(&state);
284 print_hash(nbperf, &state);
289 SIZED2(_free)(&state.graph);
290 free(state.g);
291 free(state.visited);