]> sigrok.org Git - libsigrok.git/blobdiff - libsigrok-internal.h
libsigrok-internal.h: add helper macro to read 8 bits integer
[libsigrok.git] / libsigrok-internal.h
index aa8283f1c070c5eca237e46334692caca589f329..05d3f2aef368f9069130ec51e5052a2362a4cc24 100644 (file)
 #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