Advertisement
Guest User

offsetof.diff: Simulavr pointer cast fix

a guest
Apr 12th, 2011
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 0.68 KB | None | 0 0
  1. --- src/simulavr-0.1.2.6/src/intvects.h.old 2011-04-13 02:26:29.000000000 +0000
  2. +++ src/simulavr-0.1.2.6/src/intvects.h 2011-04-13 02:27:37.000000000 +0000
  3. @@ -26,6 +26,8 @@
  4.  #ifndef SIM_INTVECTS_H
  5.  #define SIM_INTVECTS_H
  6.  
  7. +#include <stddef.h>
  8. +
  9.  enum _sleep_modes
  10.  {
  11.      SLEEP_MODE_IDLE,
  12. @@ -83,7 +85,7 @@ struct _IntVect
  13.     an index enumeration. */
  14.  
  15.  #define irq_vect_table_index(vect) \
  16. -    ( ((unsigned int) (&( ((IntVectTable *)(0)) -> vect))) / sizeof(IntVect) )
  17. +    ( offsetof(IntVectTable, vect) / sizeof(IntVect) )
  18.  
  19.  /* No device will have all of these vectors, but must define a structure which
  20.     has a slot for each interrupt. If the device doesn't support the
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement