Dear list,

I have code like this which dispatches on
the type of a homogenous vector:

(define (gl-vector->type vec)
  (cond
    ((bytes? vec) GL_UNSIGNED_BYTE)
    ((s8vector? vec) GL_BYTE)
    ((u16vector? vec) GL_UNSIGNED_SHORT)
    ((s16vector? vec) GL_SHORT)
    ((u32vector? vec) GL_UNSIGNED_INT)
    ((s32vector? vec) GL_INT)
    ((f32vector? vec) GL_FLOAT)
    ((f64vector? vec) GL_DOUBLE)))

I was wondering if there is a more efficient way to
do this, one which doesn't involve a linear scan
over all possible types. I presume that at the C level
there is a "type tag" associated with any of these types;
is it possible to access this from the Racket level?

Thanks,

Stephan
_________________________________________________
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users

Reply via email to