![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
ももいくん
Fork of 2016_Sp_momoi_taka by
Utils.h@0:736c76a75def, 2015-04-30 (annotated)
- Committer:
- hirokimineshita
- Date:
- Thu Apr 30 05:59:05 2015 +0000
- Revision:
- 0:736c76a75def
2015/04/30 PM 2 upload
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hirokimineshita | 0:736c76a75def | 1 | |
hirokimineshita | 0:736c76a75def | 2 | typedef unsigned char u8; |
hirokimineshita | 0:736c76a75def | 3 | typedef unsigned short u16; |
hirokimineshita | 0:736c76a75def | 4 | typedef unsigned long u32; |
hirokimineshita | 0:736c76a75def | 5 | |
hirokimineshita | 0:736c76a75def | 6 | void DelayMS(int ms); |
hirokimineshita | 0:736c76a75def | 7 | |
hirokimineshita | 0:736c76a75def | 8 | void printfBytes(const char* label,const u8* data, int len); |
hirokimineshita | 0:736c76a75def | 9 | void printHex(const u8* d, int len); |
hirokimineshita | 0:736c76a75def | 10 | |
hirokimineshita | 0:736c76a75def | 11 | #ifndef min |
hirokimineshita | 0:736c76a75def | 12 | #define min(_a,_b) ((_a) < (_b) ? (_a) : (_b)) |
hirokimineshita | 0:736c76a75def | 13 | #endif |
hirokimineshita | 0:736c76a75def | 14 | |
hirokimineshita | 0:736c76a75def | 15 | |
hirokimineshita | 0:736c76a75def | 16 | inline int LE16(const u8* d) |
hirokimineshita | 0:736c76a75def | 17 | { |
hirokimineshita | 0:736c76a75def | 18 | return d[0] | (d[1] << 8); |
hirokimineshita | 0:736c76a75def | 19 | } |
hirokimineshita | 0:736c76a75def | 20 | |
hirokimineshita | 0:736c76a75def | 21 | inline u32 BE32(const u8* d) |
hirokimineshita | 0:736c76a75def | 22 | { |
hirokimineshita | 0:736c76a75def | 23 | return (d[0] << 24) | (d[1] << 16) | (d[2] << 8) | d[3]; |
hirokimineshita | 0:736c76a75def | 24 | } |
hirokimineshita | 0:736c76a75def | 25 | |
hirokimineshita | 0:736c76a75def | 26 | inline void BE32(u32 n, u8* d) |
hirokimineshita | 0:736c76a75def | 27 | { |
hirokimineshita | 0:736c76a75def | 28 | d[0] = (u8)(n >> 24); |
hirokimineshita | 0:736c76a75def | 29 | d[1] = (u8)(n >> 16); |
hirokimineshita | 0:736c76a75def | 30 | d[2] = (u8)(n >> 8); |
hirokimineshita | 0:736c76a75def | 31 | d[3] = (u8)n; |
hirokimineshita | 0:736c76a75def | 32 | } |
hirokimineshita | 0:736c76a75def | 33 | |
hirokimineshita | 0:736c76a75def | 34 | inline void BE16(u32 n, u8* d) |
hirokimineshita | 0:736c76a75def | 35 | { |
hirokimineshita | 0:736c76a75def | 36 | d[0] = (u8)(n >> 8); |
hirokimineshita | 0:736c76a75def | 37 | d[1] = (u8)n; |
hirokimineshita | 0:736c76a75def | 38 | } |