|
of_getbit
|
|
Full name
|
pfc_n_cst_numerical.of_getbit
|
Access
|
public
|
Extend of
|
boolean
|
Return value
|
boolean
|
Prototype
|
public function boolean of_getbit(long,unsignedinteger)
|
Name
|
Datatype
|
lb_null
|
Boolean
|
public function boolean of_getbit (long al_decimal, unsignedinteger ai_bit);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_GetBit
//
// Access: public
//
// Arguments:
// al_decimal Decimal value whose on/off value needs to be determined (e.g. 47).
// ai_bit Position bit from right to left on the Decimal value.
//
// Returns: boolean
// True if the value is On.
// False if the value is Off.
// If any argument's value is NULL, function returns NULL.
//
// Description: Determines if the nth binary bit of a decimal number is
// 1 or 0.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 5.0 Initial version
// 5.0.03 Fixed problem when dealing with large numbers (>32k)
// from "mod int" to "int mod"
//
//////////////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////////////
Boolean lb_null
//Check parameters
If IsNull(al_decimal) or IsNull(ai_bit) then
SetNull(lb_null)
Return lb_null
End If
//Assumption ai_bit is the nth bit counting right to left with
//the leftmost bit being bit one.
//al_decimal is a binary number as a base 10 long.
If Int(Mod(al_decimal / (2 ^(ai_bit - 1)), 2)) > 0 Then
Return True
End If
Return False
end function
Name
|
Owner
|
systemfunctions.int |
systemfunctions
|
systemfunctions.isnull |
systemfunctions
|
systemfunctions.mod |
systemfunctions
|
systemfunctions.setnull |
systemfunctions
|