[Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register]

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
http://www.oooforum.org/forum/viewtopic.phtml?p=73055#73055
_________________
Want to make OOo Drawings like the colored flower design to the left?
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
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT - 8 Hours Page 1 of 1

 Jump to: Select a forum OpenOffice.org Forums----------------Setup and TroubleshootingOpenOffice.org WriterOpenOffice.org CalcOpenOffice.org ImpressOpenOffice.org DrawOpenOffice.org MathOpenOffice.org BaseOpenOffice.org Macros and APIOpenOffice.org Code Snippets Community Forums----------------General DiscussionSite Feedback
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