From b9fa6cb54b40ce580a9c2995e428445333cc2c6c Mon Sep 17 00:00:00 2001 From: "matthias.ringwald" Date: Sat, 18 Jul 2009 08:06:03 +0000 Subject: [PATCH] use casts also for 16-bit values --- src/hci.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hci.h b/src/hci.h index 147716c66..945a901cd 100644 --- a/src/hci.h +++ b/src/hci.h @@ -15,7 +15,7 @@ #include "bt_control.h" // helper for BT little endian format -#define READ_BT_16( buffer, pos) (buffer[pos] | (buffer[pos+1] << 8)) +#define READ_BT_16( buffer, pos) ( ((uint16_t) buffer[pos]) | (((uint16_t)buffer[pos+1]) << 8)) #define READ_BT_24( buffer, pos) ( ((uint32_t) buffer[pos]) | (((uint32_t)buffer[pos+1]) << 8) | (((uint32_t)buffer[pos+2]) << 16)) #define READ_BT_32( buffer, pos) ( ((uint32_t) buffer[pos]) | (((uint32_t)buffer[pos+1]) << 8) | (((uint32_t)buffer[pos+2]) << 16) | (((uint32_t) buffer[pos+3])) << 24)