11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

If bitstring = [0,0,1,1,0], when searching from position 3, the first 1 bit is bit-3 (becausesearch is inclusive of the position bit) and the first 0 bit is bit-5.// Set a to [0,0,1,1,0]SET $BIT(a,1) = 0SET $BIT(a,2) = 0SET $BIT(a,3) = 1SET $BIT(a,4) = 1SET $BIT(a,5) = 0// Find first 1 bit from position 3WRITE !,"found 1 bit at position:",$BITFIND(a,1,3)// Find first 0 bit from position 3WRITE !,"found 0 bit at position:",$BITFIND(a,0,3)See Also• $BIT function• $BITCOUNT function• $BITLOGIC function• $FACTOR function$BITLOGIC$BITLOGICPerforms bit-wise operations on bitstrings.$BITLOGIC(bitstring_expression,length)Parametersbitstring_expressionlengthA bitstring expression consisting of one or morebitstrings and the logical operators &, |, and ~. Abitstring can be specified as a local variable, aprocess-private global, a global, or the constant "".Thenull string ("") has a bitstring length of 0.Optional — The length, in bits, of the resulting bitstring.If length is not specified it defaults to the length of thelongest bitstring in bitstring_expression.Description$BITLOGIC evaluates a bit-wise operation on one or more bitstring values, as specified bybitstring_expression, and returns the resulting bitstring.<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 187

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!