X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=headers%2Futils.h;fp=headers%2Futils.h;h=0d23060b56ee6ace79a1a44a63c40c924a7e99f0;hb=82204679646dbb05f22adf6dca9bca18943ea9f6;hp=0000000000000000000000000000000000000000;hpb=ef44630f65b5f9238efd8555cc8c5fb5bbf97ea1;p=taskasaur.git diff --git a/headers/utils.h b/headers/utils.h new file mode 100644 index 0000000..0d23060 --- /dev/null +++ b/headers/utils.h @@ -0,0 +1,21 @@ + +#ifndef __UTILS_H__ +#define __UTILS_H__ + +#define \ +array_length(type, array) \ +({ \ + type* m_arr; \ + int m_len; \ + \ + m_arr = (type*)array; \ + m_len = 0; \ + \ + while (m_arr[m_len] != 0) { \ + m_len += 1; \ + } \ + \ + m_len; \ +}) + +#endif