#ifndef __CONVENIENCE__
#define __CONVENIENCE__

typedef struct {
	unsigned long quot;                  /**< The Quotient. */
	unsigned long rem;                   /**< The Remainder. */
} ludiv_t;

// define the unsigned version of this function
extern ludiv_t ludiv(unsigned long __num, unsigned long __denom) __asm__("__udivmodsi4") __attribute__((__const__));

// define some program memory macros
#define puts_PSTR(msg) puts_P(PSTR(msg))
#define sscanf_PSTR(B, F, ...) sscanf_P(B, PSTR(F), __VA_ARGS__)
#define strcmp_PSTR(S, PS) strcmp_P(S, PSTR(PS))
#define printf_PSTR(S, ...) printf_P(PSTR(S), __VA_ARGS__)
#define strequal_PSTR(S, PS) (strcmp_P(S, PSTR(PS)) == 0)

#define _BV2(v,s) (v << s)
#define BSET(b, m) (b |= (typeof(b))(m))
#define BCLR(b, m) (b &= (typeof(b))(~(m)))
#define XDATA

#endif

