![](http://forums.netduino.com/uploads/profile/photo-thumb-19729.jpg?_r=0)
Best Answer Nishant, 24 February 2014 - 06:50 AM
okay so the solution was to compare the mask with the result like>> if ((this_led_color & mask) == mask) and its done!
Go to the full post![](http://forums.netduino.com/public/style_images/master/right_white_10px.png)
![]() |
  | |||||||||||||
![]() |
|
![]() |
||||||||||||
![]() ![]() Best Answer Nishant, 24 February 2014 - 06:50 AM
okay so the solution was to compare the mask with the result like>> if ((this_led_color & mask) == mask) and its done! Go to the full post![]()
2 replies to this topic
#1
Posted 24 February 2014 - 06:32 AM How to tackle with such pure C implementations in C#: if ((this_led_color & mask)) SDI.Write(true); else SDI.Write(false); its shows me the error: Error 17 Cannot implicitly convert type 'long' to 'bool'
"Real Men can Accomplish Anything"
nishant@winacro.com www.winacro.com
#2
Posted 24 February 2014 - 06:50 AM Best Answer okay so the solution was to compare the mask with the result like>> if ((this_led_color & mask) == mask) and its done!
"Real Men can Accomplish Anything"
nishant@winacro.com www.winacro.com
#3
Posted 24 February 2014 - 09:45 PM
That makes it compile but it's not quite the same thing, I'd say it translates into this:
if ((this_led_color & mask) != 0) SDI.Write(true);else SDI.Write(false);Checking for equality to mask is no longer the same when mask has other than a single bit set. 0 user(s) are reading this topic0 members, 0 guests, 0 anonymous users | ||||||||||||||
![]() |
||||||||||||||
![]() |
|
![]() |
||||||||||||
![]() |
This webpage is licensed under a Creative Commons Attribution-ShareAlike License. | ![]() |
||||||||||||
![]() |