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
Re: Decomposing a bit field? [message #71811 is a reply to message #71716] Wed, 21 July 2010 03:29 Go to previous message
Steve[5] is currently offline  Steve[5]
Messages: 10
Registered: September 2007
Junior Member
Rob wrote:

> 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.

ISHFT - moves bits right or left so that the bits you want are at the
end of the value. AND selects the bits that you want.
>
> What I need to extract is the information in the folowing form:
>
> Bit 0: 0 or 1

bit0= ishft(15982561,0) and 1B
> Bits 1-4: 0-15

bits1to4 = ishft(15982561,-1) and 17B

> Bit 5: 0 or 1

bit5 = ishft(15982561,-5) and 1B

> Bits 6-8: 0-8

bits6to8 = ishft(15982561,-6) and 7B

> 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: Fri Oct 10 19:38:13 PDT 2025

Total time taken to generate the page: 1.03805 seconds