home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hot Shareware 35
/
hot35.iso
/
ficheros
/
LVB
/
T2W32534.ZIP
/
_BITSTR.FRM
< prev
next >
Wrap
Text File
|
1998-05-02
|
38KB
|
1,218 lines
VERSION 5.00
Object = "{0BA686C6-F7D3-101A-993E-0000C0EF6F5E}#1.0#0"; "THREED32.OCX"
Begin VB.Form frmBitString
BorderStyle = 4 'Fixed ToolWindow
Caption = "Bit string"
ClientHeight = 4035
ClientLeft = 870
ClientTop = 2115
ClientWidth = 9885
MaxButton = 0 'False
MDIChild = -1 'True
PaletteMode = 1 'UseZOrder
ScaleHeight = 4035
ScaleWidth = 9885
ShowInTaskbar = 0 'False
Begin VB.TextBox txt_Result
BackColor = &H00C0C0C0&
BorderStyle = 0 'None
Height = 2895
Left = 90
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 10
Top = 540
Width = 9645
End
Begin Threed.SSPanel SSPanel2
Align = 2 'Align Bottom
Height = 465
Left = 0
TabIndex = 0
Top = 3570
Width = 9885
_Version = 65536
_ExtentX = 17436
_ExtentY = 820
_StockProps = 15
BackColor = 12632256
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Begin VB.TextBox Text1
Height = 285
Left = 1440
TabIndex = 2
Tag = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Top = 90
Width = 7485
End
Begin Threed.SSCommand SSCommand2
Height = 285
Left = 9000
TabIndex = 3
Top = 90
Width = 825
_Version = 65536
_ExtentX = 1455
_ExtentY = 503
_StockProps = 78
Caption = "&Reset"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BevelWidth = 1
Outline = 0 'False
End
Begin VB.Label Label1
Caption = "&Enter a test string"
Height = 255
Left = 90
TabIndex = 1
Top = 120
Width = 1275
End
End
Begin Threed.SSPanel SSPanel1
Align = 1 'Align Top
Height = 480
Left = 0
TabIndex = 4
Top = 0
Width = 9885
_Version = 65536
_ExtentX = 17436
_ExtentY = 847
_StockProps = 15
ForeColor = -2147483640
BackColor = 12632256
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Begin VB.ComboBox cmb_Function
Height = 315
Left = 1365
TabIndex = 5
Top = 75
Width = 7305
End
Begin Threed.SSCommand cmdNP
Height = 300
Index = 1
Left = 9570
TabIndex = 9
Top = 90
Width = 255
_Version = 65536
_ExtentX = 450
_ExtentY = 529
_StockProps = 78
Caption = ">"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BevelWidth = 1
Font3D = 3
RoundedCorners = 0 'False
Outline = 0 'False
End
Begin Threed.SSCommand cmdNP
Height = 300
Index = 0
Left = 8730
TabIndex = 8
Top = 90
Width = 255
_Version = 65536
_ExtentX = 450
_ExtentY = 529
_StockProps = 78
Caption = "<"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BevelWidth = 1
Font3D = 3
RoundedCorners = 0 'False
Outline = 0 'False
End
Begin Threed.SSCommand SSCommand1
Default = -1 'True
Height = 300
Left = 9045
TabIndex = 6
Top = 90
Width = 465
_Version = 65536
_ExtentX = 820
_ExtentY = 529
_StockProps = 78
Caption = "&Go"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BevelWidth = 1
RoundedCorners = 0 'False
Outline = 0 'False
End
Begin VB.Label Label2
Caption = "&Select a function"
Height = 255
Left = 90
TabIndex = 7
Top = 120
Width = 1275
End
End
End
Attribute VB_Name = "frmBitString"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Option Base 1
Private Const Iteration = 250
Dim IsLoaded As Integer
Dim TimerStartOk As Integer
Dim TimerCloseOk As Integer
Dim TimerHandle As Integer
Dim TimerValue As Long
Private Sub cmb_Function_Click()
If (IsLoaded = False) Then Exit Sub
Call cDisableFI(mdiT2W.Picture1)
SSPanel2.Visible = True
txt_Result = ""
DoEvents
Select Case cmb_Function.ListIndex
Case 0
SSPanel2.Visible = False
Call TestCreateBits
Case 1
Call TestFindBitReset
Case 2
Call TestFindBitSet
Case 3
Call TestGetBit
Case 4
SSPanel2.Visible = False
Call TestGiveBitPalindrome
Case 5
Call TestIsBitPalindrome
Case 6
Call TestReverseAllBits
Case 7
Call TestReverseAllBitsByChar
Case 8
Call TestSetAllBits
Case 9
Call TestSetBit
Case 10
Call TestToggleAllBits
Case 11
Call TestToggleBit
Case 12
SSPanel2.Visible = False
Call TestGetBitValue
Case 13
SSPanel2.Visible = False
Call TestSetBitValue
Case 14
SSPanel2.Visible = False
Call TestB2I
Case 15
SSPanel2.Visible = False
Call TestGetBit2Value
Case 16
SSPanel2.Visible = False
Call TestSetBit2Value
Case 17
SSPanel2.Visible = False
Call TestB2I
End Select
DoEvents
Call cEnableFI(mdiT2W.Picture1)
End Sub
Private Sub cmdNP_Click(Index As Integer)
Call sub_NextPrev(cmb_Function, Index)
End Sub
Private Sub Form_Activate()
mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
End Sub
Private Sub Form_Load()
IsLoaded = False
Show
Text1.Text = Text1.Tag + LCase$(Text1.Tag)
Call sub_Load_Combo(cmb_Function, T2WDirInst + "_bitstr.t2w")
IsLoaded = True
End Sub
Private Sub SSCommand1_Click()
Call cmb_Function_Click
End Sub
Private Sub TestCreateBits()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
intResult = 0
strResult = ""
strDisplay = ""
strResult = cCreateBits(1024)
strDisplay = strDisplay + "Create a bit string for 1024 bits is '" & Len(strResult) & "' bytes" & vbCrLf & vbCrLf
strResult = cCreateBits(512)
strDisplay = strDisplay + "Create a bit string for 512 bits is '" & Len(strResult) & "' bytes" & vbCrLf & vbCrLf
strResult = cCreateBits(33)
strDisplay = strDisplay + "Create a bit string for 33 bits is '" & Len(strResult) & "' bytes" & vbCrLf & vbCrLf
strResult = cCreateBits(1)
strDisplay = strDisplay + "Create a bit string for 1 bits is '" & Len(strResult) & "' bytes" & vbCrLf & vbCrLf
strResult = cCreateBits(-1)
strDisplay = strDisplay + "Create a bit string for -1 bits is '" & Len(strResult) & "' bytes" & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cCreateBits(1024)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFindBitReset()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim strData As String
Dim i As Integer
intResult = 0
strResult = ""
strDisplay = ""
strData = Text1.Text
strDisplay = strDisplay + "The following bits are Reset (False) " & vbCrLf & vbCrLf
intResult = True
Do
intResult = cFindBitReset(strData, intResult)
If (intResult <> True) Then strDisplay = strDisplay & intResult & ", "
Loop Until (intResult = True)
strDisplay = Left$(strDisplay, Len(strDisplay) - 1)
strDisplay = strDisplay & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cFindBitReset(strData, i)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub SSCommand2_Click()
Text1.Text = Text1.Tag + LCase$(Text1.Tag)
Call SSCommand1_Click
End Sub
Private Sub TestFindBitSet()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim strData As String
Dim i As Integer
intResult = 0
strResult = ""
strDisplay = ""
strData = Text1.Text
strDisplay = strDisplay + "The following bits are Set (True) " & vbCrLf & vbCrLf
intResult = True
Do
intResult = cFindBitSet(strData, intResult)
If (intResult <> True) Then strDisplay = strDisplay & intResult & ", "
Loop Until (intResult = True)
strDisplay = Left$(strDisplay, Len(strDisplay) - 1)
strDisplay = strDisplay & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cFindBitSet(strData, i)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestGetBit()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim strData As String
Dim i As Integer
intResult = 0
strResult = ""
strDisplay = ""
strData = Text1.Text
strDisplay = strDisplay + "Bit '1' is '" & IIf(cGetBit(strData, 1), "set", "reset") & "'" & vbCrLf
strDisplay = strDisplay + "Bit '3' is '" & IIf(cGetBit(strData, 3), "set", "reset") & "'" & vbCrLf
strDisplay = strDisplay + "Bit '5' is '" & IIf(cGetBit(strData, 5), "set", "reset") & "'" & vbCrLf
strDisplay = strDisplay + "Bit '7' is '" & IIf(cGetBit(strData, 7), "set", "reset") & "'" & vbCrLf
strDisplay = strDisplay + "Bit '100' is '" & IIf(cGetBit(strData, 100), "set", "reset") & "'" & vbCrLf
strDisplay = strDisplay + "Bit '102' is '" & IIf(cGetBit(strData, 102), "set", "reset") & "'" & vbCrLf
strDisplay = strDisplay + "Bit '104' is '" & IIf(cGetBit(strData, 104), "set", "reset") & "'" & vbCrLf
strDisplay = strDisplay + "Bit '106' is '" & IIf(cGetBit(strData, 106), "set", "reset") & "'" & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cGetBit(strData, i)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestGiveBitPalindrome()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim strData As String
Dim i As Integer
intResult = 0
strResult = ""
strDisplay = ""
strResult = cGiveBitPalindrome()
strDisplay = strDisplay + "The followings chars are Bit Palindrome : " & vbCrLf & vbCrLf
strDisplay = strDisplay + "chr(0) and " & cBlockCharFromRight(cGiveBitPalindrome(), 1)
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cGiveBitPalindrome()
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestIsBitPalindrome()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim strData As String
Dim i As Integer
intResult = 0
strResult = ""
strDisplay = ""
strData = Text1.Text
intResult = cIsBitPalindrome(strData)
strDisplay = strDisplay + "Test string is " & IIf(intResult, "", "not ") & "Bit Palindrome " & vbCrLf & vbCrLf
strDisplay = strDisplay + "The followings chars are Bit Palindrome : " & vbCrLf
For i = 1 To 255
If cIsBitPalindrome(Chr$(i)) Then strDisplay = strDisplay + Chr$(i) & " (" & i & ") "
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cIsBitPalindrome(strData)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestReverseAllBits()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim strData As String
Dim i As Integer
intResult = 0
strResult = ""
strDisplay = ""
strData = Text1.Text
Call cReverseAllBits(strData)
strDisplay = strDisplay + "Reverse all bits is " & vbCrLf & strData & vbCrLf & vbCrLf
Call cReverseAllBits(strData)
strDisplay = strDisplay + "Reverse all bits of the reversed is " & vbCrLf & strData & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
Call cReverseAllBits(strData)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestReverseAllBitsByChar()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim strData As String
Dim i As Integer
intResult = 0
strResult = ""
strDisplay = ""
strData = Text1.Text
Call cReverseAllBitsByChar(strData)
strDisplay = strDisplay + "Reverse all bits by char is " & vbCrLf & strData & vbCrLf & vbCrLf
Call cReverseAllBitsByChar(strData)
strDisplay = strDisplay + "Reverse all bits by char of the reversed is " & vbCrLf & strData & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
Call cReverseAllBitsByChar(strData)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestSetAllBits()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim strData As String
Dim i As Integer
intResult = 0
strResult = ""
strDisplay = ""
strData = Text1.Text
Call cSetAllBits(strData, True)
strDisplay = strDisplay + "Set all bits is " & vbCrLf
strDisplay = strDisplay + strData & vbCrLf & vbCrLf
Call cSetAllBits(strData, False)
strDisplay = strDisplay + "Reset all bits is " & vbCrLf
strDisplay = strDisplay + strData & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
Call cSetAllBits(strData, True)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestSetBit()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim strData As String
Dim i As Integer
intResult = 0
strResult = ""
strDisplay = ""
strData = Text1.Text
Call cSetBit(strData, 0, True)
strDisplay = strDisplay + "Set bit '0' is '" & strData & "'" & vbCrLf
Call cSetBit(strData, 5, True)
strDisplay = strDisplay + "Set bit '5' is '" & strData & "'" & vbCrLf
Call cSetBit(strData, 7, True)
strDisplay = strDisplay + "Set bit '7' is '" & strData & "'" & vbCrLf & vbCrLf
Call cSetBit(strData, 0, False)
strDisplay = strDisplay + "Reset bit '0' is '" & strData & "'" & vbCrLf
Call cSetBit(strData, 5, False)
strDisplay = strDisplay + "Reset bit '5' is '" & strData & "'" & vbCrLf
Call cSetBit(strData, 7, False)
strDisplay = strDisplay + "Reset bit '7' is '" & strData & "'" & vbCrLf & vbCrLf
Call cSetBit(strData, 22, True)
strDisplay = strDisplay + "Set bit '22' is '" & strData & "'" & vbCrLf
Call cSetBit(strData, 30, True)
strDisplay = strDisplay + "Set bit '30' is '" & strData & "'" & vbCrLf
Call cSetBit(strData, 38, True)
strDisplay = strDisplay + "Set bit '38' is '" & strData & "'" & vbCrLf & vbCrLf
Call cSetBit(strData, 22, False)
strDisplay = strDisplay + "Reset bit '22' is '" & strData & "'" & vbCrLf
Call cSetBit(strData, 30, False)
strDisplay = strDisplay + "Reset bit '30' is '" & strData & "'" & vbCrLf
Call cSetBit(strData, 38, False)
strDisplay = strDisplay + "Reset bit '38' is '" & strData & "'" & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
Call cSetBit(strData, 0, True)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestToggleAllBits()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim strData As String
Dim i As Integer
intResult = 0
strResult = ""
strDisplay = ""
strData = Text1.Text
Call cToggleAllBits(strData)
strDisplay = strDisplay + "Toggle all bits is " & vbCrLf
strDisplay = strDisplay + strData & vbCrLf & vbCrLf
Call cToggleAllBits(strData)
strDisplay = strDisplay + "Toggle all bits of the toggled is " & vbCrLf
strDisplay = strDisplay + strData & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
Call cToggleAllBits(strData)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestToggleBit()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim strData As String
Dim i As Integer
intResult = 0
strResult = ""
strDisplay = ""
strData = Text1.Text
Call cToggleBit(strData, 0)
strDisplay = strDisplay + "Toggle bit '0' is '" & strData & "'" & vbCrLf
Call cToggleBit(strData, 5)
strDisplay = strDisplay + "Toggle bit '5' is '" & strData & "'" & vbCrLf
Call cToggleBit(strData, 7)
strDisplay = strDisplay + "Toggle bit '7' is '" & strData & "'" & vbCrLf & vbCrLf
Call cToggleBit(strData, 0)
strDisplay = strDisplay + "Toggle bit '0' is '" & strData & "'" & vbCrLf
Call cToggleBit(strData, 5)
strDisplay = strDisplay + "Toggle bit '5' is '" & strData & "'" & vbCrLf
Call cToggleBit(strData, 7)
strDisplay = strDisplay + "Toggle bit '7' is '" & strData & "'" & vbCrLf & vbCrLf
Call cToggleBit(strData, 22)
strDisplay = strDisplay + "Toggle bit '22' is '" & strData & "'" & vbCrLf
Call cToggleBit(strData, 30)
strDisplay = strDisplay + "Toggle bit '30' is '" & strData & "'" & vbCrLf
Call cToggleBit(strData, 38)
strDisplay = strDisplay + "Toggle bit '38' is '" & strData & "'" & vbCrLf & vbCrLf
Call cToggleBit(strData, 22)
strDisplay = strDisplay + "Toggle bit '22' is '" & strData & "'" & vbCrLf
Call cToggleBit(strData, 30)
strDisplay = strDisplay + "Toggle bit '30' is '" & strData & "'" & vbCrLf
Call cToggleBit(strData, 38)
strDisplay = strDisplay + "Toggle bit '38' is '" & strData & "'" & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
Call cToggleBit(strData, 0)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestGetBitValue()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim bData As Byte
Dim iData As Integer
Dim lData As Long
Dim sData As Single
Dim dData As Double
Dim i As Integer
intResult = 0
strResult = ""
strDisplay = ""
Call cRndInit(-1)
bData = (Abs(cRndI()) Mod 256)
iData = Abs(cRndI())
lData = Abs(cRndL())
sData = Abs(cRndS())
dData = Abs(cRndD())
strDisplay = strDisplay + "Byte value : " & bData & " (" & cToBinary(cMKB(bData)) & ")" & vbCrLf
strDisplay = strDisplay + " bit 0 is " & IIf(cGetBitB(bData, 0), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 1 is " & IIf(cGetBitB(bData, 1), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 3 is " & IIf(cGetBitB(bData, 3), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 5 is " & IIf(cGetBitB(bData, 5), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 7 is " & IIf(cGetBitB(bData, 7), "set", "reset") & vbCrLf & vbCrLf
strDisplay = strDisplay + "Integer value : " & iData & " (" & cToBinary(cMKI(iData)) & ")" & vbCrLf
strDisplay = strDisplay + " bit 0 is " & IIf(cGetBitI(iData, 0), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 3 is " & IIf(cGetBitI(iData, 3), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 7 is " & IIf(cGetBitI(iData, 7), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 11 is " & IIf(cGetBitI(iData, 11), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 15 is " & IIf(cGetBitI(iData, 15), "set", "reset") & vbCrLf & vbCrLf
strDisplay = strDisplay + "Long value : " & lData & " (" & cToBinary(cMKL(lData)) & ")" & vbCrLf
strDisplay = strDisplay + " bit 0 is " & IIf(cGetBitL(lData, 0), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 5 is " & IIf(cGetBitL(lData, 5), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 10 is " & IIf(cGetBitL(lData, 10), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 15 is " & IIf(cGetBitL(lData, 15), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 20 is " & IIf(cGetBitL(lData, 20), "set", "reset") & vbCrLf & vbCrLf
strDisplay = strDisplay + "Single value : " & sData & " (" & cToBinary(cMKS(sData)) & ")" & vbCrLf
strDisplay = strDisplay + " bit 0 is " & IIf(cGetBitS(sData, 0), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 5 is " & IIf(cGetBitS(sData, 5), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 10 is " & IIf(cGetBitS(sData, 10), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 15 is " & IIf(cGetBitS(sData, 15), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 20 is " & IIf(cGetBitS(sData, 20), "set", "reset") & vbCrLf & vbCrLf
strDisplay = strDisplay + "Double value : " & dData & " (" & cToBinary(cMKD(dData)) & ")" & vbCrLf
strDisplay = strDisplay + " bit 0 is " & IIf(cGetBitD(dData, 0), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 10 is " & IIf(cGetBitD(dData, 10), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 20 is " & IIf(cGetBitD(dData, 20), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 30 is " & IIf(cGetBitD(dData, 30), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 40 is " & IIf(cGetBitD(dData, 40), "set", "reset") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cGetBitI(iData, i)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestGetBit2Value()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim iData As Integer
Dim lData As Long
Dim i As Integer
intResult = 0
strResult = ""
strDisplay = ""
Call cRndInit(-1)
iData = Abs(cRndI())
lData = Abs(cRndL())
strDisplay = strDisplay + "Integer value : " & iData & " (" & cToBinary(cMKI(iData)) & ")" & vbCrLf
strDisplay = strDisplay + " bit 0 is " & IIf(cGetBitI2(iData, 0), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 3 is " & IIf(cGetBitI2(iData, 3), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 7 is " & IIf(cGetBitI2(iData, 7), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 11 is " & IIf(cGetBitI2(iData, 11), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 15 is " & IIf(cGetBitI2(iData, 15), "set", "reset") & vbCrLf & vbCrLf
strDisplay = strDisplay + "Long value : " & lData & " (" & cToBinary(cMKL(lData)) & ")" & vbCrLf
strDisplay = strDisplay + " bit 0 is " & IIf(cGetBitL2(lData, 0), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 5 is " & IIf(cGetBitL2(lData, 5), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 10 is " & IIf(cGetBitL2(lData, 10), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 15 is " & IIf(cGetBitL2(lData, 15), "set", "reset") & vbCrLf
strDisplay = strDisplay + " bit 20 is " & IIf(cGetBitL2(lData, 20), "set", "reset") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cGetBitI2(iData, i)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestSetBitValue()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim bData As Byte
Dim iData As Integer
Dim lData As Long
Dim sData As Single
Dim dData As Double
Dim i As Integer
intResult = 0
strResult = ""
strDisplay = ""
bData = (Abs(cRndI()) Mod 256)
iData = Abs(cRndI())
lData = Abs(cRndL())
sData = Abs(cRndS())
dData = Abs(cRndD())
strDisplay = strDisplay + "Byte value : " & bData & " (" & cToBinary(cMKB(bData)) & ")" & vbCrLf
Call cSetBitB(bData, 0, True)
strDisplay = strDisplay + " set bit 0 is " & bData & " (" & cToBinary(cMKB(bData)) & ")" & vbCrLf
Call cSetBitB(bData, 3, False)
strDisplay = strDisplay + " reset bit 3 is " & bData & " (" & cToBinary(cMKB(bData)) & ")" & vbCrLf
Call cSetBitB(bData, 5, True)
strDisplay = strDisplay + " set bit 5 is " & bData & " (" & cToBinary(cMKB(bData)) & ")" & vbCrLf & vbCrLf
strDisplay = strDisplay + "Integer value : " & iData & " (" & cToBinary(cMKI(iData)) & ")" & vbCrLf
Call cSetBitI(iData, 3, True)
strDisplay = strDisplay + " set bit 3 is " & iData & " (" & cToBinary(cMKI(iData)) & ")" & vbCrLf
Call cSetBitI(iData, 6, False)
strDisplay = strDisplay + " reset bit 6 is " & iData & " (" & cToBinary(cMKI(iData)) & ")" & vbCrLf
Call cSetBitI(iData, 9, True)
strDisplay = strDisplay + " set bit 9 is " & iData & " (" & cToBinary(cMKI(iData)) & ")" & vbCrLf & vbCrLf
strDisplay = strDisplay + "Long value : " & lData & " (" & cToBinary(cMKL(lData)) & ")" & vbCrLf
Call cSetBitL(lData, 6, True)
strDisplay = strDisplay + " set bit 6 is " & lData & " (" & cToBinary(cMKL(lData)) & ")" & vbCrLf
Call cSetBitL(lData, 12, False)
strDisplay = strDisplay + " reset bit 12 is " & lData & " (" & cToBinary(cMKL(lData)) & ")" & vbCrLf
Call cSetBitL(lData, 24, True)
strDisplay = strDisplay + " set bit 24 is " & lData & " (" & cToBinary(cMKL(lData)) & ")" & vbCrLf & vbCrLf
strDisplay = strDisplay + "Single value : " & sData & " (" & cToBinary(cMKS(sData)) & ")" & vbCrLf
Call cSetBitS(sData, 0, True)
strDisplay = strDisplay + " set bit 0 is " & sData & " (" & cToBinary(cMKS(sData)) & ")" & vbCrLf
Call cSetBitS(sData, 3, True)
strDisplay = strDisplay + " set bit 3 is " & sData & " (" & cToBinary(cMKS(sData)) & ")" & vbCrLf
Call cSetBitS(sData, 6, True)
strDisplay = strDisplay + " set bit 6 is " & sData & " (" & cToBinary(cMKS(sData)) & ")" & vbCrLf
Call cSetBitS(sData, 12, True)
strDisplay = strDisplay + " set bit 12 is " & sData & " (" & cToBinary(cMKS(sData)) & ")" & vbCrLf
Call cSetBitS(sData, 24, True)
strDisplay = strDisplay + " set bit 24 is " & sData & " (" & cToBinary(cMKS(sData)) & ")" & vbCrLf & vbCrLf
strDisplay = strDisplay + "Double value : " & dData & " (" & cToBinary(cMKD(dData)) & ")" & vbCrLf
Call cSetBitD(dData, 0, False)
strDisplay = strDisplay + " reset bit 0 is " & dData & " (" & cToBinary(cMKD(dData)) & ")" & vbCrLf
Call cSetBitD(dData, 3, False)
strDisplay = strDisplay + " reset bit 3 is " & dData & " (" & cToBinary(cMKD(dData)) & ")" & vbCrLf
Call cSetBitD(dData, 12, False)
strDisplay = strDisplay + " reset bit 12 is " & dData & " (" & cToBinary(cMKD(dData)) & ")" & vbCrLf
Call cSetBitD(dData, 24, False)
strDisplay = strDisplay + " reset bit 24 is " & dData & " (" & cToBinary(cMKD(dData)) & ")" & vbCrLf
Call cSetBitD(dData, 48, False)
strDisplay = strDisplay + " reset bit 48 is " & dData & " (" & cToBinary(cMKD(dData)) & ")" & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
Call cSetBitI(iData, 0, True)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestSetBit2Value()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim iData As Integer
Dim lData As Long
Dim i As Integer
intResult = 0
strResult = ""
strDisplay = ""
iData = Abs(cRndI())
lData = Abs(cRndL())
strDisplay = strDisplay + "Integer value : " & iData & " (" & cI2B(iData) & ")" & vbCrLf
Call cSetBitI2(iData, 3, True)
strDisplay = strDisplay + " set bit 3 is " & iData & " (" & cI2B(iData) & ")" & vbCrLf
Call cSetBitI2(iData, 6, False)
strDisplay = strDisplay + " reset bit 6 is " & iData & " (" & cI2B(iData) & ")" & vbCrLf
Call cSetBitI2(iData, 9, True)
strDisplay = strDisplay + " set bit 9 is " & iData & " (" & cI2B(iData) & ")" & vbCrLf & vbCrLf
strDisplay = strDisplay + "Long value : " & lData & " (" & cL2B(lData) & ")" & vbCrLf
Call cSetBitL2(lData, 6, True)
strDisplay = strDisplay + " set bit 6 is " & lData & " (" & cL2B(lData) & ")" & vbCrLf
Call cSetBitL2(lData, 12, False)
strDisplay = strDisplay + " reset bit 12 is " & lData & " (" & cL2B(lData) & ")" & vbCrLf
Call cSetBitL2(lData, 24, True)
strDisplay = strDisplay + " set bit 24 is " & lData & " (" & cL2B(lData) & ")" & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
Call cSetBitI2(iData, 0, True)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestB2I()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim i1 As String
Dim i2 As String
Dim l1 As String
Dim l2 As String
i1 = "1010101010101010"
i2 = "0101010101010101"
l1 = "10101010101010101010101010101010"
l2 = "01010101010101010101010101010101"
lResult = 0
strResult = ""
strDisplay = ""
strDisplay = strDisplay & "B2I of " & i1 & " is " & cB2I(i1) & vbCrLf
strDisplay = strDisplay & "B2I of " & i2 & " is " & cB2I(i2) & vbCrLf & vbCrLf
strDisplay = strDisplay & "I2B of " & cB2I(i1) & " is " & cI2B(cB2I(i1)) & vbCrLf
strDisplay = strDisplay & "I2B of " & cB2I(i2) & " is " & cI2B(cB2I(i2)) & vbCrLf & vbCrLf
strDisplay = strDisplay & "I2Bext (bin = x0) of " & cB2I(i1) & " is " & cI2Bext(cB2I(i1), "x0") & vbCrLf
strDisplay = strDisplay & "I2Bext (bin = x0) of " & cB2I(i2) & " is " & cI2Bext(cB2I(i2), "x0") & vbCrLf & vbCrLf
strDisplay = strDisplay & "B2L of " & l1 & " is " & cB2L(l1) & vbCrLf
strDisplay = strDisplay & "B2L of " & l2 & " is " & cB2L(l2) & vbCrLf & vbCrLf
strDisplay = strDisplay & "L2B of " & cB2L(l1) & " is " & cL2B(cB2L(l1)) & vbCrLf
strDisplay = strDisplay & "L2B of " & cB2L(l2) & " is " & cL2B(cB2L(l2)) & vbCrLf & vbCrLf
strDisplay = strDisplay & "L2Bext (bin = x0) of " & cB2L(l1) & " is " & cL2Bext(cB2L(l1), "x0") & vbCrLf
strDisplay = strDisplay & "L2Bext (bin = x0) of " & cB2L(l2) & " is " & cL2Bext(cB2L(l2), "x0") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cB2I(12345)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub