of_bitwisenot


pfcapsrv.pbl   >   pfc_n_cst_numerical   >   of_bitwisenot   

Full name pfc_n_cst_numerical.of_bitwisenot
Access public
Extend of long
Return value long
Prototype public function long of_bitwisenot(long)

Name Datatype
No Data

Name Datatype
li_Cnt Integer
li_Count Integer
ll_Result Long
ls_Result string
ls_Value string

public function long of_bitwisenot (long al_value);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  		of_BitwiseNot
//
//	Access: 			public
//
//	Arguments:
//	al_Value		The value to be used in the operation (e.g. 55)
//
//	Returns: 		Long
//						The result of the NOT operation (e.g. 8)
//						If the argument's value is NULL, function returns NULL.
//
//	Description:   Performs a bitwise NOT operation (! al_Value),
//						which reverses each bit.
//						(! 55) = 8
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	5.0     Initial version
// 5.0.02  Fixed function from returning negative wrong value
//
//////////////////////////////////////////////////////////////////////////////
//
//	Copyright © 1996-1997 Sybase, Inc. and its subsidiaries.  All rights reserved.
//	Any distribution of the PowerBuilder Foundation Classes (PFC)
//	source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////

Integer		li_Cnt, li_Count
Long			ll_Result
string		ls_Value, ls_Result

// Check for nulls
If IsNull(al_Value) Then
	SetNull(ll_Result)
	Return ll_Result
End If

// return a binary string e.g. 100101
ls_Value = of_binary(al_Value)
li_Cnt = Len(ls_Value)

// change 0 to 1 and 1 to 0
For li_Count = 1 To li_Cnt
	If Mid(ls_Value, li_Count, 1) = '0' Then
		ls_Result = ls_Result + '1'
	Else
		ls_Result = ls_Result + '0'
	End If
End For
	
// return the result in decimal form e.g. 57	
Return of_decimal(ls_Result)	

end function

     
Name Owner
No Data

     
Name Owner
systemfunctions.isnull systemfunctions
systemfunctions.len systemfunctions
systemfunctions.mid systemfunctions
systemfunctions.setnull systemfunctions
pfc_n_cst_numerical.of_binary pfc_n_cst_numerical
pfc_n_cst_numerical.of_decimal pfc_n_cst_numerical

     
Full name
No Data

     
Name Scope
No Data