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

Home » Public Forums » archive » Re: Need help identifying left most zero bit
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: Need help identifying left most zero bit [message #30131 is a reply to message #30130] Sat, 06 April 2002 12:43 Go to previous messageGo to previous message
Pavel Romashkin is currently offline  Pavel Romashkin
Messages: 166
Registered: April 1999
Senior Member
Phil,
Download the last function from David's page here:
http://www.dfanning.com/misc_tips/binary_hex.html
Then try:

print, (where(binary(-15s) eq 0))[0]

Cheers,
Pavel

"Phil" <plmcelwee@yahoo.com> wrote in message
news:a3589d11.0204051007.10df5da6@posting.google.com...
> I'm working with negative (two's complement) 16-bit numbers and could
> use some help. What I'd like to do is have a function that will tell
> me the location of the left-most zero bit for any given negative
> 16-bit number. Here are some examples to illustrate my goal.
>
> if x = -2, which is 1111 1111 1111 1110, then return 1
> if x = -5, which is 1111 1111 1111 1011, then return 3
> if x = -15, which is 1111 1111 1111 0111, then return 4
> if x = -8, which is 1111 1111 1111 1000, then return 3
>
> Is there something built-in to IDL that will accomplish this? Or does
> anyone have any other suggestions?
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Interfacing the functions
Next Topic: Does IDL have a #include functionality

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

Current Time: Sun Oct 12 00:26:34 PDT 2025

Total time taken to generate the page: 0.32137 seconds