Files
s7netplus/S7.Net/Types/Boolean.cs
Derek Heiser e65c0eed25 S7.NET Testability Updates
Removed the Controls project and existing Test projects. Added new Test
project and references to NUnit and Should projects for testing.
Extracted IPlc interface to help test projects that reference this
library. Also implemented the IDisposable interface on the Plc object so
that references to mSocket would be cleaned up appropriately when the
object is blown away.
2013-02-09 10:17:47 -06:00

29 lines
655 B
C#

using System;
using System.Collections.Generic;
using System.Text;
namespace S7.Types
{
public static class Boolean
{
public static bool GetValue(byte value, int bit)
{
if ((value & (int)Math.Pow(2, bit)) != 0)
return true;
else
return false;
}
public static byte SetBit(byte value, int bit)
{
return (byte)(value | (byte)Math.Pow(2, bit));
}
public static byte ClearBit(byte value, int bit)
{
return (byte)(value & (byte)(~(byte)Math.Pow(2, bit)));
}
}
}