#define offsetof(type, field) ((int) &((type *)0)->field)
#endif /* offsetof */
+#ifndef lengthof
+#define lengthof(array) (sizeof (array) / sizeof ((array)[0]))
+#endif
+
#ifndef TYPEALIGN
#define TYPEALIGN(ALIGNVAL,LEN) \
(((long) (LEN) + ((ALIGNVAL) - 1)) & ~((long) ((ALIGNVAL) - 1)))