BlitzCoder Essentials
•
Home Page
•
About BlitzCoder
•
Contributors
•
Terms of Use
•
Email Us
Main Areas
•
BlitzCoder Chat
•
Discussions
•
Articles/Tutorials
•
Code Database
•
Link Database
•
Showcase Area
•
Worklogs
•
Competitions
Special Areas
•
Undocumented
Other Blitz Sites
•
Blitz Basic Home
•
Blitz Showcase
•
BlitzPlay Library
Forum Login
Username:
Password:
•
Register Now!
BlitzCoder Code Archives Page
Main Codes Page
"Bit Fields"
, by poedboy
BitFields allow you to store multiple on/off values within a single byte.
2 Functions : GetBit() and SetBit()
Code
;**************************************** ;Name: BitField Functions ;Author: A Pissed Off Boy ;Date: 2:25am 3/10/03 ;Updated: n/a ;**************************************** ;Purpose: Lets you read and save multiple on/off values into a single byte. Function GetBit(Byte%,Bit%);returns the bit of the given byte If Byte% And 2^Bit% Then Return True Else Return False End Function Function SetBit(Byte%,Bit%,Value%);if value>0 then the bit will be set--will return the new combined byte Local Slot%=2^Bit% If Value%>0 Then Return (Byte% And (255-Slot%)) Or (Slot%*Value%) Else Return Byte% And (255-Slot%) End Function
Copyright(c) 2000-2004, BlitzCoder. All Rights Reserved.
Code software created by Krylar's Kreations