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

Home » Public Forums » archive » Decomposing a bit field?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Decomposing a bit field? [message #71716] Wed, 21 July 2010 02:40 Go to previous message
rjp23 is currently offline  rjp23
Messages: 97
Registered: June 2010
Member
Hi all,

I have some data that is contained within a 32-bit field.

I'm using some code from a colleague which seems to almost do what I
want but not quite.

An example of one of the data values is 15982561

The following code takes this and creates an array of 1s and 0s for
whether each bit is set or not.

test=intarr(32)
for i=0, 31 do begin test[i]=(ISHFT((15982561),-i) AND 1B)

However, for example bits 1-4 need to be combined (and contain data
from 0-15). As I don't quite understand what the code above is doing
I'm not sure how to (or if it can be) modified to not just operate on
the individual bits but on groups of bits.

What I need to extract is the information in the folowing form:

Bit 0: 0 or 1
Bits 1-4: 0-15
Bit 5: 0 or 1
Bits 6-8: 0-8
etc

Thanks in advance
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Read these data in structure
Next Topic: Re: Read these data in structure

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

Current Time: Thu Oct 09 21:37:28 PDT 2025

Total time taken to generate the page: 1.20016 seconds