| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- /*
- DO NOT EDIT THIS FILE!
- This file was automatically generated by the bstruct generator.
- */
- #include <stdint.h>
- #include <misc/balign.h>
- typedef struct str0_struct str0;
- typedef struct {
- int x_off;
- int x_size;
- #ifndef NDEBUG
- int x_count;
- #endif
- int len;
- int align;
- } str0Params;
- static void str0Params_Init (str0Params *o, int n)
- {
- int cur_size;
- int cur_align;
- int cur_count;
- o->len = 0;
- o->align = 1;
- cur_size = (sizeof(int));
- cur_align = (__alignof__(int));
- cur_count = (n);
- o->x_off = balign_up(o->len, cur_align);
- o->x_size = cur_size;
- #ifndef NDEBUG
- o->x_count = cur_count;
- #endif
- o->len = o->x_off + (cur_count * cur_size);
- o->align = (cur_align > o->align ? cur_align : o->align);
- }
- static int * str0_x (str0Params *o, str0 *s)
- {
- return (int *)((uint8_t *)s + o->x_off);
- }
- static int * str0_x_at (str0Params *o, str0 *s, int i)
- {
- ASSERT(i >= 0)
- ASSERT(i < o->x_count)
- return (int *)((uint8_t *)s + o->x_off + i * o->x_size);
- }
- typedef struct str1_struct str1;
- typedef struct {
- int a_off;
- int a_size;
- #ifndef NDEBUG
- int a_count;
- #endif
- int b_off;
- int b_size;
- #ifndef NDEBUG
- int b_count;
- #endif
- int c_off;
- int c_size;
- #ifndef NDEBUG
- int c_count;
- #endif
- str0Params d_params;
- int d_off;
- int d_size;
- #ifndef NDEBUG
- int d_count;
- #endif
- int len;
- int align;
- } str1Params;
- static void str1Params_Init (str1Params *o, int nb, int nc, int m)
- {
- int cur_size;
- int cur_align;
- int cur_count;
- o->len = 0;
- o->align = 1;
- cur_size = (sizeof(int));
- cur_align = (__alignof__(int));
- cur_count = (1);
- o->a_off = balign_up(o->len, cur_align);
- o->a_size = cur_size;
- #ifndef NDEBUG
- o->a_count = cur_count;
- #endif
- o->len = o->a_off + (cur_count * cur_size);
- o->align = (cur_align > o->align ? cur_align : o->align);
- cur_size = (sizeof(char));
- cur_align = (__alignof__(char));
- cur_count = (nb);
- o->b_off = balign_up(o->len, cur_align);
- o->b_size = cur_size;
- #ifndef NDEBUG
- o->b_count = cur_count;
- #endif
- o->len = o->b_off + (cur_count * cur_size);
- o->align = (cur_align > o->align ? cur_align : o->align);
- cur_size = (sizeof(double));
- cur_align = (__alignof__(double));
- cur_count = (nc);
- o->c_off = balign_up(o->len, cur_align);
- o->c_size = cur_size;
- #ifndef NDEBUG
- o->c_count = cur_count;
- #endif
- o->len = o->c_off + (cur_count * cur_size);
- o->align = (cur_align > o->align ? cur_align : o->align);
- str0Params_Init(&o->d_params, m);
- cur_size = o->d_params.len;
- cur_align = o->d_params.align;
- cur_count = (1);
- o->d_off = balign_up(o->len, cur_align);
- o->d_size = cur_size;
- #ifndef NDEBUG
- o->d_count = cur_count;
- #endif
- o->len = o->d_off + (cur_count * cur_size);
- o->align = (cur_align > o->align ? cur_align : o->align);
- }
- static int * str1_a (str1Params *o, str1 *s)
- {
- return (int *)((uint8_t *)s + o->a_off);
- }
- static int * str1_a_at (str1Params *o, str1 *s, int i)
- {
- ASSERT(i >= 0)
- ASSERT(i < o->a_count)
- return (int *)((uint8_t *)s + o->a_off + i * o->a_size);
- }
- static char * str1_b (str1Params *o, str1 *s)
- {
- return (char *)((uint8_t *)s + o->b_off);
- }
- static char * str1_b_at (str1Params *o, str1 *s, int i)
- {
- ASSERT(i >= 0)
- ASSERT(i < o->b_count)
- return (char *)((uint8_t *)s + o->b_off + i * o->b_size);
- }
- static double * str1_c (str1Params *o, str1 *s)
- {
- return (double *)((uint8_t *)s + o->c_off);
- }
- static double * str1_c_at (str1Params *o, str1 *s, int i)
- {
- ASSERT(i >= 0)
- ASSERT(i < o->c_count)
- return (double *)((uint8_t *)s + o->c_off + i * o->c_size);
- }
- static str0 * str1_d (str1Params *o, str1 *s)
- {
- return (str0 *)((uint8_t *)s + o->d_off);
- }
- static str0 * str1_d_at (str1Params *o, str1 *s, int i)
- {
- ASSERT(i >= 0)
- ASSERT(i < o->d_count)
- return (str0 *)((uint8_t *)s + o->d_off + i * o->d_size);
- }
|