几个位操作函数:
of_bitor(long al_valuea, long al_valueb)
integer li_Bit, li_Size
long ll_RetValue
li_Size = 2
ll_RetValue = 0
For li_Bit = 0 To 31
If Mod(Long(al_ValueA / 2^li_Bit), 2) > 0 Or Mod(Long(al_ValueB / 2^li_Bit), 2) > 0 Then
If Not Mod(Long(ll_RetValue / 2^li_Bit), 2) > 0 then
ll_RetValue += 2^li_Bit
End If
End If
Next
Return(ll_RetValue)
//////////////////////////////////////////////////////////////
of_bitand(long al_valuea, long al_valueb)
integer li_Bit, li_Size
long ll_RetValue
li_Size = 2
ll_RetValue = 0
For li_Bit = 0 To 31
If Mod(Long(al_ValueA / 2^li_Bit), 2) = Mod(Long(al_ValueB / 2^li_Bit), 2) Then
If Mod(Long(al_ValueA / 2^li_Bit), 2) = 1 then
ll_RetValue += 2^li_Bit
End If
End If
Next
Return(ll_RetValue)
////////////////////////////////////////////////////
of_bitxor(long al_valuea, long al_valueb)
integer li_Bit, li_Size
long ll_RetValue
li_Size = 2
ll_RetValue = 0
For li_Bit = 0 To 31
If not Mod(Long(al_ValueA / 2^li_Bit), 2) = Mod(Long(al_ValueB / 2^li_Bit), 2) Then
ll_RetValue += 2^li_Bit
End If
Next