Re: Bitwise NOT



Aamir Mahmood <a@xxx> wrote:
> how can i perform a bitwise NOT on a int or long or uint type variable?
> so that the bits should be inverted in the result.

~ is the bitwise not operator. For instance:

uint x = 0x1234;
uint y = ~x;

y is now 0xffffedcb

--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
.



Relevant Pages

  • Bug in VS 2005 MFC?
    ... Should LRESULT be replace with UINT? ... Ming. ... Prev by Date: ...
    (microsoft.public.vc.mfc)
  • CAnimateCtrl::Play
    ... The function CAnimateCtrl::Play takes 3 UINT arguments, ... obviously it gives a warning while compiling though it works fine with the ... Srishti ... Prev by Date: ...
    (microsoft.public.vc.mfc)
  • [PATCH 02/24] Mousedev: make module parameters visible in sysfs
    ... mousedev - make module parameters visible in sysfs ... +module_param(xres, uint, 0644); ... Prev by Date: ...
    (Linux-Kernel)
  • Re: C#
    ... usind select case .. ... Then youe S becomes ... uint S ... Prev by Date: ...
    (microsoft.public.dotnet.languages.csharp)