12#ifndef FILTERS_GP_HILBERT_CURVE_H
13#define FILTERS_GP_HILBERT_CURVE_H
15typedef struct gp_curve_state {
27static inline void gp_hilbert_curve_init(gp_curve_state *state,
int n)
38static inline void gp_hilbert_curve_getxy(gp_curve_state *state)
45 unsigned int i, temp, x = 0, y = 0;
47 for (i = 0; i < 2 * state->n; i += 2) {
48 sa = (state->s >> (i+1)) & 0x01;
49 sb = (state->s >> i) & 0x01;
57 x = (x >> 1) | (sa << 31);
58 y = (y >> 1) | ((sa ^ sb) << 31);
61 state->x = x >> (32 - state->n);
62 state->y = y >> (32 - state->n);
69static inline void gp_hilbert_curve_next(gp_curve_state *state)
75 gp_hilbert_curve_getxy(state);
81static inline int gp_hilbert_curve_continues(gp_curve_state *state)
83 return state->s < (1U<<(2*state->n));