From a4f9c35b23e120195269f5387df6dffaabe344dc Mon Sep 17 00:00:00 2001 From: Aurelien Jacobs Date: Sun, 2 Feb 2014 21:29:34 +0100 Subject: [PATCH] libsigrok-internal.h: add helper macro to read 8 bits integer matching the 16 and 32 bits one --- libsigrok-internal.h | 7 +++++++ 1 file changed, 7 insertions(+) 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