<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/">
	<channel>
		<title>Byte Me</title>
		<link>https://blogs.lotterypost.com/jadelottery/2009/4/byte-me.htm</link>
		<atom:link href="https://www.lotterypost.com/rss/blogcomments/28925" rel="self" type="application/rss+xml" />
		<description>JADELottery's Blog: Byte Me</description>
		<dc:language>en-us</dc:language>
		<generator>Lottery Post RSS Generator</generator>
		<item>
			<title>Comment #2</title>
			<link>https://blogs.lotterypost.com/jadelottery/2009/4/byte-me.htm#c35711</link>
			<guid isPermaLink="true">https://blogs.lotterypost.com/jadelottery/2009/4/byte-me.htm#c35711</guid>
			<pubDate>Sun, 12 Apr 2009 17:24:02 GMT</pubDate>
			<dc:creator>JADELottery</dc:creator>
			<description><![CDATA[<p>&#x3c;br /&#x3e;Great suggestion though.&#x3c;br</p>]]></description>
			<category>JADELottery</category>
		</item>
		<item>
			<title>Comment #1</title>
			<link>https://blogs.lotterypost.com/jadelottery/2009/4/byte-me.htm#c35708</link>
			<guid isPermaLink="true">https://blogs.lotterypost.com/jadelottery/2009/4/byte-me.htm#c35708</guid>
			<pubDate>Sun, 12 Apr 2009 15:54:21 GMT</pubDate>
			<dc:creator>Todd</dc:creator>
			<description><![CDATA[<p>&#x3c;br /&#x3e;It&#x27;s a highly subjective topic, but I had a couple of comments to throw out there for your consideration.&#x3c;br /&#x3e;&#x3c;br /&#x3e;First thing is that I&#x27;ve had to write similar multi-purpose functions, but over the years I&#x27;ve tended to break them into multiple functions -- one function per operation type.  So if I were writing similar code today, I&#x27;d probably make four separate functions -- such as bitExamine(), bitClear(), bitToggle(), and bitSet().  (All start with &#x22;bit&#x22; so they sort &#x26; group together... &#x5b;&#xa0;<a href="https://blogs.lotterypost.com/jadelottery/2009/4/byte-me.htm#c35708">More</a>&#xa0;&#x5d;</p>]]></description>
			<category>Todd</category>
		</item>
		<item>
			<title>Original Blog Entry: Byte Me</title>
			<link>https://blogs.lotterypost.com/jadelottery/2009/4/byte-me.htm</link>
			<guid isPermaLink="true">https://blogs.lotterypost.com/jadelottery/2009/4/byte-me.htm</guid>
			<pubDate>Sun, 12 Apr 2009 00:24:21 GMT</pubDate>
			<dc:creator>JADELottery</dc:creator>
			<description><![CDATA[<p>Module MyFunctions<br /><br />&#x27;------------------------------------------------------------<br /><br />&#x27;Enumerated Bit States for CSTEBit function<br /><br />&#x27;Used with CSTEBit function<br /><br />&#x27;Example:<br /><br />&#x27; &#x27;This will change the value of MyByte from HF0 to HF8<br /><br />&#x27; Dim MyByte As Byte = HF0<br /><br />&#x27; Dim ChangeThisBit As Byte = H04<br /><br />&#x27; MyByte = CSTEBit(BitState.SetBit, MyByte, ChangeThisBit)<br /><br />&#x27;------------------------------------------------------------<br /><br />Enum BitState As Byte<br /><br />ClrBit = 0 &#x27;Clear bit<br /><br />SetBit = 1 &#x27;Set bit<br /><br />TogBit = 2 &#x27;Toggle bit<br /><br />ExmBit = 3 &#x27;Examine bit<br /><br />End Enum<br /><br />&#x27;----------------------------------------------------------------------<br /><br />&#x27;Function for changing and examining bit states within a byte<br /><br />&#x27;A byte has 8 bits to Set or Clear and each position is numbered 0 to 7<br /><br />&#x27;Each position of the bits is as follows:<br /><br />&#x27;Position - 7 6 5 4 3 2 1 0<br /><br />&#x27; Bit - 1 0 1 0 1 1 0 1<br /><br />&#x27; ^ ^ ^ ^ ^ ^ ^ ^<br /><br />&#x27; Position | | | | | | | |<br /><br />&#x27; Values | | | | | | | |<br /><br />&#x27; 128---+ | | | | | | |<br /><br />&#x27; 64-----+ | | | | | |<br /><br />&#x27; 32-------+ | | | | |<br /><br />&#x27; 16---------+ | | | |<br /><br />&#x27; 8-----------+ | | |<br /><br />&#x27; 4-------------+ | |<br /><br />&#x27; 2---------------+ |<br /><br />&#x27; 1-----------------+<br /><br />&#x27;-----------------------------------------------------------------------<br /><br />Public Function CSTEBit(ByVal CSTE As Byte, ByVal Byt As Byte, ByVal Bit As Byte) As Byte<br /><br />If Bit 8 Then<br /><br />&#x27;Bit positon mask<br /><br />Dim Mask As Byte = 2 ^ Bit<br /><br />Select Case CSTE<br /><br />Case BitState.ExmBit<br /><br />&#x27;Examine bit<br /><br />&#x27;Returns a byte value of H01 for set and H00 for clear<br /><br />If ((Byt And Mask) 0) Then<br /><br />CSTEBit = 1<br /><br />Else<br /><br />CSTEBit = 0<br /><br />End If<br /><br />Case BitState.ClrBit<br /><br />&#x27;Clear bit<br /><br />CSTEBit = Byt And Not Mask<br /><br />Case BitState.TogBit<br /><br />&#x27;Toggle bit<br /><br />CSTEBit = Byt Xor Mask<br /><br />Case BitState.SetBit<br /><br />&#x27;Set bit<br /><br />CSTEBit = Byt Or Mask<br /><br />Case Else<br /><br />&#x27;Return same byte if CSTE out of bounds<br /><br />CSTEBit = Byt<br /><br />End Select<br /><br />Else<br /><br />&#x27;Return same byte if Bit is out of bounds<br /><br />CSTEBit = Byt<br /><br />End If<br /><br />End Function<br /><br />End Module<br /><br />... &#x5b;&#xa0;<a href="https://blogs.lotterypost.com/jadelottery/2009/4/byte-me.htm">More</a>&#xa0;&#x5d;</p>]]></description>
			<category>Blog Entry</category>
			<category>JADELottery</category>
			<wfw:comment>https://www.lotterypost.com/blogentry/28925</wfw:comment>
		</item>
	</channel>
</rss>

