$PBExportHeader$bitand.srf
$PBExportComments$Simple bitwise AND..
global type bitand from function_object
end type
forward prototypes
global function long bitand (long values[])
end prototypes
global function long bitand (long values[]);integer li_Bit, li_Size, li_Number = 2
long ll_RetValue, ll_ValueA, ll_ValueB
li_Size = UpperBound(Values)
If li_Size < 2 Then
MessageBox("Error","This function needs 2 values!",StopSign!,Ok!)
Return(-1)
End If
ll_RetValue = 0
ll_ValueA = Values[1]
Do
ll_ValueB = Values[li_Number]
ll_RetValue = 0
For li_Bit = 0 To 31
If Mod(Long(ll_ValueA / 2^li_Bit), 2) > 0 and Mod(Long(ll_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
ll_ValueA = ll_RetValue
li_Number++
Loop Until li_Number > li_Size