#ifndef INCLUDE_COMPILERSPECIFIC_H
#define INCLUDE_COMPILERSPECIFIC_H


        #ifdef __GNUC__
                #define INLINE                  inline
                #define STDARGS                 __attribute__((stkparm))
                #define ASMCALL
                #define CONSTCALL               __attribute__((const))
                #define FORMATCALL(a,s,f)       __attribute__((format(a,s,f)))
                #define SAVEDS(f)               f __attribute__((saveds))
                #define INTERRUPT(f)            f __attribute__((interrupt))
                #define NORETURN                __attribute__((noreturn))
                #define ALIGNED                 __attribute__((aligned(4)))
                #define REG(reg,arg)            register arg __asm(#reg)
                #define CHIP(d)                 d __attribute__((chip))

                #define min(a,b)                (((a)<(b))?(a):(b))
                #define max(a,b)                (((a)>(b))?(a):(b))
                #define abs(a)                  (((a)>0)?(a):-(a))
        #else
                #ifdef __STORM__
                        #define INLINE          __inline
                        #define STDARGS
                        #define ASMCALL
                        #define CONSTCALL
                        #define FORMATCALL(a,s,f)
                        #define SAVEDS(f)       __saveds f
                        #define INTERRUPT(f)    __interrupt f
                        #define NORETURN
                        #define ALIGNED
                        #define REG(reg,arg)    register __##reg arg
                        #define CHIP(d)         __chip d

                        #define min(a,b)        (((a)<(b))?(a):(b))
                        #define max(a,b)        (((a)>(b))?(a):(b))
                        #define abs(a)          (((a)>0)?(a):-(a))

                #else
                        #error Please add compiler specific definitions for your compiler
                #endif

        #endif


/* Special function attributes */

#define LIBCALL(f)              ASMCALL SAVEDS(f)
#define HOOKCALL(f)             ASMCALL SAVEDS(f)
#define INTCALL(f)              ASMCALL INTERRUPT(f)


#endif /* INCLUDE_COMPILERSPECIFIC_H */
