you're binary-or'ing a bit with 0x0, which means you're not going to change 
it.

There's some useful information 
here: https://en.wikipedia.org/wiki/Bit_manipulation


On Friday, December 4, 2015 at 9:47:45 AM UTC-8, Martin Somers wrote:
>
>
>
> On Friday, 4 December 2015 16:36:34 UTC, James Gilbert wrote:
>>
>> I find bits(a) more useful than bin(a). It enables me to see all the bits 
>> of an integer when experimenting with << and >> to see if I'm doing the 
>> right thing. eg, set the 2nd bit of a byte:
>>
>>
>> *julia> **a = 0b00000010*
>>
>> *0x02*
>>
>>
>> *julia> **bits(a)*
>>
>> *"00000010"*
>>
>>
>> *julia> **a = a | (0x1 << 6)*
>>
>> *0x42*
>>
>>
>> *julia> **bits(a)*
>>
>> *"01000010"*
>>
>>
> Looks interesting though when I try to set it back to the original, I get 
> 0x42
>
> a = a | (0x0 << 6)
>
> I guess im missing something :)
> M 
>

Reply via email to