comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: bit operations
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: bit operations [message #30552 is a reply to message #30551] Thu, 02 May 2002 11:01 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
"Dominik Paul" <dpaul@ukl.uni-freiburg.de> writes:

> Hi there,

> are there any other bit operations in IDL except shift and ishift?
> I would like to know, if a bit is set and I would like to set a bit by
> myself in a variable.


Dom:

The logical operators AND, OR, XOR and NOT are bitwise operators. These can be
used to both set and interrogate bits in integer values.

For example, suppose that J=5b, which is '0101' in bit notation. One can turn
on the second bit from the right with the command

IDL> J = J OR 2b

This converts J to '0111', i.e. 7b.

On the other hand, if you want to know if the 2nd bit is turned on or not, you
can find out with

IDL> IF (J AND 2B) NE 0 THEN PRINT, 'Second bit is turned on'

Bill Thompson
[Message index]
 
Read Message
Read Message
Previous Topic: Irregularly spaced tick-marks on secondary axis.
Next Topic: Need help working with large video file

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 18:37:56 PDT 2025

Total time taken to generate the page: 0.88245 seconds