mesta1 / libplctag-csharp

MIT License
68 stars 35 forks source link

WriteBool toggles bits within words, when trying to clear #9

Closed stillgreyfox closed 5 years ago

stillgreyfox commented 5 years ago

Found a bug with the bit clearing logic.

Using XOR in WriteBool() when the value is 'false' / clearing a bit within a word can result in a bit toggle, rather than a clear.

Also, replaced all the Math.Pow() calls with simple bit shifting <<

Pull request will be filed after this issue.