-/* Read mixed endian words from a buffer of 16-bit units. */
-#define LWLA_READ16(buf) GUINT16_FROM_LE(*(buf))
-#define LWLA_READ32(buf) \
- (((uint32_t)GUINT16_FROM_LE((buf)[0]) << 16) | \
- ((uint32_t)GUINT16_FROM_LE((buf)[1])))
-#define LWLA_READ64(buf) \
- (((uint64_t)LWLA_READ32((buf))) | \
- ((uint64_t)LWLA_READ32((buf) + 2) << 32))
-
-/* Convert 16-bit argument to little endian. */
+/* Rotate argument n bits to the left.
+ * This construct is an idiom recognized by GCC as bit rotation.
+ */
+#define LROTATE(a, n) (((a) << (n)) | ((a) >> (CHAR_BIT * sizeof(a) - (n))))
+
+/* Convert 16-bit little endian LWLA protocol word to machine word order. */
+#define LWLA_TO_UINT16(val) GUINT16_FROM_LE(val)
+
+/* Convert 32-bit mixed endian LWLA protocol word to machine word order. */
+#define LWLA_TO_UINT32(val) LROTATE(GUINT32_FROM_LE(val), 16)
+
+/* Convert 16-bit argument to LWLA protocol word. */