This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

offsetof.diff: Simulavr pointer cast fix

By: a guest on Apr 12th, 2011  |  syntax: Diff  |  size: 0.68 KB  |  views: 99  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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
clone this paste RAW Paste Data