From: Aurelien Jacobs Date: Sun, 2 Feb 2014 20:29:34 +0000 (+0100) Subject: libsigrok-internal.h: add helper macro to read 8 bits integer X-Git-Tag: libsigrok-0.3.0~158 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=a4f9c35b23e120195269f5387df6dffaabe344dc;p=libsigrok.git libsigrok-internal.h: add helper macro to read 8 bits integer matching the 16 and 32 bits one --- diff --git a/libsigrok-internal.h b/libsigrok-internal.h index aa8283f1..05d3f2ae 100644 --- a/libsigrok-internal.h +++ b/libsigrok-internal.h @@ -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