|
-
May 24th, 2003, 07:41 PM
#1
bitwise Not in vb.net?
It's "~" in C#. I belive there isn't an operator for it in vb.net. But could someone at least explain how it works so I can somehow get it to work in vb.net?
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
May 25th, 2003, 02:59 AM
#2
Sleep mode
-
May 25th, 2003, 05:40 AM
#3
Sleep mode
VB.NET Example . There are more if you just searched Google !
-
May 25th, 2003, 03:53 PM
#4
I had seen two of those links.... anyways, I thought there is a difference between the ~ and ! in C# (well there is, but basically they do the same thing, and that's all I wanted to know).
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
May 26th, 2003, 02:51 AM
#5
Originally posted by MrPolite
I had seen two of those links.... anyways, I thought there is a difference between the ~ and ! in C# (well there is, but basically they do the same thing, and that's all I wanted to know).
No, they really don't!
E.g.
if(3 && !3)
is never true.
if(3 && ~3)
is always true.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
May 26th, 2003, 03:10 AM
#6
Originally posted by CornedBee
No, they really don't!
E.g.
if(3 && !3)
is never true.
if(3 && ~3)
is always true.
ok I'm confused would you care to explain?
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
May 26th, 2003, 09:35 AM
#7
! operates on boolean values.
if(3 && !3)
does this:
First, it converts 3 to bool. 3 != 0, so it gets converted to true. Next it evaluates !3. Because ! (logical NOT) operates on bool, 3 gets converted to true again. Then it is negated to false and the AND expression fails.
if(3 && ~3)
does this:
First it again converts 3 to true. The second part is different. ~ (bitwise NOT) operates not on booleans but on integers. 3 stays 3 and assuming 32-bit signed integers, the bit pattern 00000000000000000000000000000011 (3) is negated to 11111111111111111111111111111100 (-4).
-4 then gets converted to bool and results in true (-4 != 0). So the AND expression succeeds.
So bitwise NOT and logical NOT are logical NOT the same
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
May 26th, 2003, 02:06 PM
#8
Hyperactive Member
Originally posted by CornedBee
11111111111111111111111111111100 (-4).
-4 then gets converted to bool and results in true (-4 != 0). So the AND expression succeeds.
Umm, I'm not quite sure how that equates to -4! I assume the first bit designates the sign (+/-), but then wouldn't -4 = 10000000000000000000000000000100?
EDIT:
Never mind! I figured it out!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|