The shift and AND operators are usually used in these situations (>> and 
&). With the following definition:

getbit(x::UInt64,i) = Int((x >> (64-i))&1)

You can get any bit from a 64-bit unsigned integer. For example 
getbit(0xa7f1d92a82c8d8fe,29).

On Wednesday, December 2, 2015 at 11:41:51 AM UTC+2, Martin Somers wrote:
>
> Just wondering 
>
>  
>
> I have a 32 bit hex number as following -  0xa7f6d92a82c8d8f2
>
>  
>
> How do I acccertain the 29th bit 
>
>  
>
> Functions bin and bits all return an ascii string 
>
>  
>
>  
>
> bin(0xa7f1d92a82c8d8fe)
>
> "1010011111110001110110010010101010000010110010001101100011111110"
>
>  
>
> what is the most efficient way of finding a bit of a hex value 
>
>  
>
> bin(0xa7f1d92a82c8d8fe)[29] and then convert this string to a bool?
>
>  
>
> Interested to see the alternatives
>
>
> cheers
>
> M
>
>  
>
>  
>

Reply via email to