#include #include #define SCM_UNPACK(x) ((uintptr_t) (x)) typedef struct scm_unused_struct * SCM; /* Smob print hook for uniform vectors. */ int uvec_print (SCM); int uvec_print (SCM uvec) { union { uint8_t *u8; int8_t *s8; uint16_t *u16; int16_t *s16; uint32_t *u32; } np; size_t i = 0; const size_t uvlen = 10; void *uptr = NULL; switch (SCM_UNPACK ((((struct scm_unused_struct * *)((int *) (SCM_UNPACK (uvec)))) [1]))) { case 0: np.u8 = (uint8_t *) uptr; break; case 1: np.s8 = (int8_t *) uptr; break; case 2: np.u16 = (uint16_t *) uptr; break; case 3: np.s16 = (int16_t *) uptr; break; case 4: np.u32 = (uint32_t *) uptr; break; default: abort (); /* Sanity check. */ break; } while (i < uvlen) { i = (int) *np.u8; np.u8++; } return 1; } int main() { uvec_print(NULL); return 0; } /* Local variables: */ /* compile-command: "gcc -g -O2 -Wall -Wmissing-prototypes -S njtest.c" */ /* End: */