|
-
Oct 11th, 2001, 03:24 PM
#1
Thread Starter
Addicted Member
Unary &~
How do I find the address-of the one's complement of 15 (&~15 (C++ code)) in VB? At least I think that's how it is said.
Thanks
-
Oct 11th, 2001, 05:03 PM
#2
I know C, but I'm finding that people asking for C stuff out of context means that I usually give a bad answer.
Post the code you got this from.
To answer your question -
Code:
Dim a as long
a = 15
z = varptr(a)
z is now a pointer to a
If this is for a function call, pass z ByVal.
I'm not sure how to do a one's complement with VB.
-
Oct 11th, 2001, 09:02 PM
#3
Thread Starter
Addicted Member
Here is the code:
Code:
bmp.bmWidthBytes = ((bmp.bmWidth + 15) &~15)/8;
And I saw somewhere were perhaps a one's complement can be acheived some how with Not?
Thanks
-
Oct 12th, 2001, 06:50 AM
#4
Oh. That's what I thought.
Code:
((bmp.bmWidth + 15) &~15)/8;
should be:
((bmp.bmWidth + 15) & ~15)/8;
which is
( bmp.bmwidth + 15) and one's complement of 15
not the address of.
You are right, not does give one's complement, except in VB I"ve gotten wierd results. If you want to assume not will work-- this is your code:
Code:
dim i as long
i= (bmp.bmwidth + 15) and ( not 15)
i = i/8
bmp.bmWidthBytes = i
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
|