Sorry, it's my faults. I should change the line
    long b = (a & 0xFFFFFFFF);
to 
    long b = (a & 0xFFFFFFFFL);


--- 09年2月18日,周三, Jiang <webs...@yahoo.cn> 写道:
发件人: Jiang <webs...@yahoo.cn>
主题: [android-developers] Does bitwise operation "& " for the number of contains 
bug?
收件人: android-developers@googlegroups.com
日期: 2009,218,周三,4:41下午

Hello guys,
I want to obtain least 32 bits from a number of type long, so I perform bitwise 
operation "&" on the number with bits mask 0xFFFFFFFF, but the result is error, 
it still contains other bits. 

for example:
long a = 0x1234567890abL;
long b = (a & 0xFFFFFFFF);
I expect the value of b is 0x567890abL, but in practice, it is still 
0x1234567890abL.

Is this a bug ?

Thanks.
-John.




        好玩贺卡等你发,邮箱贺卡全新上线!







      ___________________________________________________________ 
  好玩贺卡等你发,邮箱贺卡全新上线! 
http://card.mail.cn.yahoo.com/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to