libsigrok-internal.h: add helper macro to read 8 bits integer

matching the 16 and 32 bits one
This commit is contained in:
Aurelien Jacobs 2014-02-02 21:29:34 +01:00 committed by Uwe Hermann
parent 6e94eb4142
commit a4f9c35b23
1 changed files with 7 additions and 0 deletions

View File

@ -50,6 +50,13 @@
#define ARRAY_AND_SIZE(a) (a), ARRAY_SIZE(a)
#endif
/**
* Read a 8 bits integer out of memory.
* @param x a pointer to the input memory
* @return the corresponding integer
*/
#define R8(x) ((unsigned)((const uint8_t*)(x))[0])
/**
* Read a 16 bits big endian integer out of memory.
* @param x a pointer to the input memory