Skip to contentSkip to conversation

ADXL34X orientation definition

DISCUSSION Dmitry Torokhov 2 participants 3 messages Dec 7, 2013 – Dec 9, 2013 HID

lore
Share & tools
lore
#0 lore raw

Hi Michael,

I was going though Coverity reports and it looks like definition of

#define ADXL346_2D_ORIENT(x) (((x) & 0x3) >> 4)

is not correct as it will always evaluate to 0. Should the mask be 0x30 instead?

Thanks.

Signature · 1 line
Dmitry
#1 lore raw
Quoted 11 lines · Dmitry Torokhov

Hi Michael,

I was going though Coverity reports and it looks like definition of

#define ADXL346_2D_ORIENT(x) (((x) & 0x3) >> 4)

is not correct as it will always evaluate to 0. Should the mask be 0x30 instead?

Thanks.

Hi Dmitry,

Good catch!

Yes, of course - the mask should be 0x30.
Shall I send a patch?

Signature · 8 lines
Greetings,
Michael

--
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368;
Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin,
Margaret Seif
#2 lore raw
Quoted 10 lines · Michael Hennerich
Quoted 9 lines · Dmitry Torokhov

Hi Michael,

I was going though Coverity reports and it looks like definition of

#define ADXL346_2D_ORIENT(x) (((x) & 0x3) >> 4)

is not correct as it will always evaluate to 0. Should the mask be 0x30 instead?

Quoted 8 lines
Quoted 1 line

Thanks.

Hi Dmitry,

Good catch!

Yes, of course - the mask should be 0x30.
Shall I send a patch?

That would be great.

Signature · 1 line
Dmitry