Products > Programming

c operator precedence error

<< < (4/4)

TheCalligrapher:

--- Quote from: snarkysparky on January 20, 2022, 02:47:17 pm ---The problem was happening in this part   ->   RemIoDiscreteLocalCopy &= ~RET_WRD_UP_SOLENOID_ERROR;      when    #define RET_WRD_LW_SOLENOID_ERROR        _U_(0x1) << 13

after  changing #define RET_WRD_LW_SOLENOID_ERROR                 (_U_(0x1) << 13)

it worked.

--- End quote ---

Well, of course, when the shift is non-zero, it becomes a completely different story. Obviosuly, `~1u << 13` is different from `~(1u << 13)`.

SiliconWizard:

--- Quote from: TheCalligrapher on January 21, 2022, 07:42:20 am ---
--- Quote from: snarkysparky on January 20, 2022, 02:47:17 pm ---The problem was happening in this part   ->   RemIoDiscreteLocalCopy &= ~RET_WRD_UP_SOLENOID_ERROR;      when    #define RET_WRD_LW_SOLENOID_ERROR        _U_(0x1) << 13

after  changing #define RET_WRD_LW_SOLENOID_ERROR                 (_U_(0x1) << 13)

it worked.

--- End quote ---

Well, of course, when the shift is non-zero, it becomes a completely different story. Obviosuly, `~1u << 13` is different from `~(1u << 13)`.

--- End quote ---

Well. Yeah. ;D
Looks like someone has a problem using macros...

Navigation

[0] Message Index

[*] Previous page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod