Siarhei > The logic is that the first line contains a portable endian neutral read of > big endian data into native format: >> s = (ptr[0] & 0xff) << 8 | (ptr[1] & 0xff); the intent is to swap bytes using this first statement if either - host order is little endian and the ptr array is stored big endian - host order is big endian and the ptr array is stored little endian the second case could be done with a cast to a 16-bit int rather than bit arithmetic. We don't exercise all the various cases. -- Brad Midgley -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html