Advertisement
Guest User

Untitled

a guest
Jan 16th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.73 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <stdint.h>
  4.  
  5. #define ODP_ALIGN __attribute__ ((aligned (512)))
  6.  
  7. typedef struct {
  8.         uint32_t testv;
  9.         uint32_t testv1;
  10.         uint16_t testv4;
  11. } test_t ODP_ALIGN;
  12.  
  13. typedef struct {
  14.         uint32_t testv;
  15.         uint32_t testv1;
  16.         uint16_t testv4;
  17. } ODP_ALIGN test2_t;
  18.  
  19. int main(void)
  20. {
  21.         test_t unaligned;
  22.         //test_t unaligned2[3];
  23.         test2_t aligned[5];
  24.         int i;
  25.  
  26.  
  27.         printf("test_t size %lu\n", sizeof(unaligned));
  28.         printf("test_t align %lu\n", _Alignof(unaligned));
  29.         printf("test2_t size %lu\n",  sizeof(aligned[0]));
  30.         printf("test2_t align %lu\n",  _Alignof(aligned));
  31.         return 0;
  32. }
  33. ~
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement