| View previous topic :: View next topic |
| Author |
Message |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
Posted: Tue Jun 08, 2004 5:59 am Post subject: Bit manipulation utility functions |
|
|
| Code: | ' Return True if a particular bit in nBits is set.
' Bit 0 is the least significant bit.
Function IsBitSet( ByVal nBits As Long, ByVal nBitNum As Integer ) As Boolean
IsBitSet = GetBitNum( nBits, nBitNum ) > 0
End Function
' Return a particular bit from nBits.
' Bit 0 is the least significant bit.
Function GetBitNum( ByVal nBits As Long, ByVal nBitNum As Integer ) As Long
Do While nBitNum > 0
nBitNum = nBitNum - 1
nBits = Int( nBits / 2 ) ' shift right
Loop
GetBitNum = nBits Mod 2
End Function
' Set a particular bit in nBits.
' It does not matter what the previous status of the bit was,
' end ends up as a 1 bit.
' Bit 0 is the least significant bit.
Function SetBit( ByVal nBits As Long, ByVal nBitNum As Integer ) As Long
nBit = 1
Do While nBitNum > 0
nBitNum = nBitNum - 1
nBit = nBit * 2 ' shift left
Loop
SetBit = nBits Or nBit
End Function
' Clear a particular bit in nBits.
' It does not matter what the previous status of the bit was,
' end ends up as a 0 bit.
' Bit 0 is the least significant bit.
Function ClearBit( ByVal nBits As Long, ByVal nBitNum As Integer ) As Long
Dim nBit As Long
nBit = 1
Do While nBitNum > 0
nBitNum = nBitNum - 1
nBit = nBit * 2 ' shift left
Loop
ClearBit = nBits And (Not nBit)
End Function
|
2005-04-02
The latest version of this code is at....
http://www.oooforum.org/forum/viewtopic.phtml?p=73055#73055 _________________ Want to make OOo Drawings like the colored flower design to the left? |
|
| Back to top |
|
 |
freshkaa Newbie

Joined: 06 Mar 2010 Posts: 1
|
Posted: Wed Mar 10, 2010 1:31 am Post subject: |
|
|
What should I do about an ex-boyfriend who keeps blaming me? My ex-boyfriend keeps blaming me for the problems he's having now. He says that he's lost friends due to the fact that we were dating, but I didn't do anything to his friends, or even once suggest that I didn't like those friends. He also says that my life is perfect and happy and his is horrible, but I was the one there talking with him for hours at night trying to comfort him, while I couldn't get out more than 4 sentences about the problems I was having.
_______________________
asian marriage |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|