typedef int GLint; typedef unsigned int GLuint; typedef float GLfloat; static void fxt1_encode(void); static void texstore_rgba_fxt1(void) { fxt1_encode(); } structfoo = { texstore_rgba_fxt1}; typedef unsigned long long Fx64; static void fxt1_quantize_ALPHA1(void) { GLuint *cc; const GLint n_vect = 3; const GLint n_comp = 4; GLfloat vec[1 + 1 + 1][4]; GLint i, j, k; Fx64 hi; GLint j1, j2; GLint v1 = 0, v2 = 0; GLfloat err = 1e9; GLfloat tv[2 * 2][4]; for (j1 = 0; j1 < 2; j1++) { for (j2 = 2; j2 < 4; j2++) { GLfloat e = 0.0F; for (i = 0; i < n_comp; i++) { e += (tv[j1][i] - tv[j2][i]) * (tv[j1][i] - tv[j2][i]); } if (e < err) { v1 = j1; } } } for (i = 0; i < n_comp; i++) { vec[0][i] = tv[1 - v1][i]; } for (j = n_vect - 1; j >= 0; j--) { for (i = 0; i < n_comp - 1; i++) { hi |= (GLuint) (vec[j][i] / 8.0F); } } ((Fx64 *) cc)[1] = hi; } static void fxt1_quantize(void) { GLint k; for (k = 0; k < 4; k++) fxt1_quantize_ALPHA1(); } static void fxt1_encode(void) { fxt1_quantize(); }