• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <stddef.h>
2 #ifdef DEBUG
3 #include <stdio.h>
4 #endif
5 
6 #ifdef  __cplusplus
7 extern "C" void abort (void);
8 #else
9 extern void abort (void);
10 #endif
11 
12 int
check_int(int * i,int align)13 check_int (int *i, int align)
14 {
15   *i = 20;
16   if ((((ptrdiff_t) i) & (align - 1)) != 0)
17     {
18 #ifdef DEBUG
19       printf ("\nUnalign address (%d): %p!\n", align, i);
20 #endif
21       abort ();
22     }
23   return *i;
24 }
25 
26 void
check(void * p,int align)27 check (void *p, int align)
28 {
29   if ((((ptrdiff_t) p) & (align - 1)) != 0)
30     {
31 #ifdef DEBUG
32       printf ("\nUnalign address (%d): %p!\n", align, p);
33 #endif
34       abort ();
35     }
36 }
37