X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=Inc%2Futil.h;h=6772a50adeec9b177b3e9d1cdff0c9ffb5015379;hb=9c15daf7606d9a8ae58736963c8130cf7f4333ea;hp=388a1bd758946472fc8a1ba8701c9f03d5ec4de5;hpb=4628d046ad479a2b7310bc598b663984742b9a22;p=home-hw.git diff --git a/Inc/util.h b/Inc/util.h index 388a1bd..6772a50 100644 --- a/Inc/util.h +++ b/Inc/util.h @@ -1,4 +1,5 @@ #include +#include typedef unsigned int uint; typedef uint8_t byte; @@ -10,6 +11,17 @@ typedef int32_t s32; #define MIN(x,y) ((x) < (y) ? (x) : (y)) #define MAX(x,y) ((x) > (y) ? (x) : (y)) +static inline uint get_u16_le(byte *p) +{ + return (p[1] << 8) | p[0]; +} + +static inline void put_u16_le(byte *p, u16 x) +{ + p[0] = x; + p[1] = x >> 8; +} + // debug.c #undef DEBUG_SEMIHOSTING