slang-users mailing list

[2006 Date Index] [2006 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [slang-users] Reg bitwise &


Ajay Kumar <Ajay.Kumar@xxxxxxxxxx> wrote:
>Int1 = (25 & 1)
>Int2 = (25 & 2)
>Int3 = (25 & 4)
>
>Int4 = (26 & 1)
>Int5 = (26 & 2)
>Int6 = (26 & 4)
>
>What is expected return values in the IntX specified above? How does
>slang proceeds with calculating the values.

The binary representations of the above numbers are given in the
following table:

     1  00001
     2  00010
     4  00100
    25  11001
    26  11010

So:

   Int1 = 25&1 = 00001 = 1
   Int2 = 25&2 = 00000 = 0
   Int3 = 25&4 = 00000 = 0
   Int4 = 26&1 = 00000 = 0
   Int5 = 26&2 = 00010 = 1
   int6 = 26&4 = 00000 = 0

If you are getting different values, then there is a problem.

--John

_______________________________________________
To unsubscribe, visit http://jedsoft.org/slang/mailinglists.html


[2006 date index] [2006 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]