bit comparison in integer 
Author Message
 bit comparison in integer

I'll got no answer on this question two weeks ago so I'll
try again:

How do I create in vb-script something that do the same
as the tsql "&" operator:

if (MyInteger & 24576 = 16384) then ... end if

ie checking bitvise if the 15's bit is 1 and the 14's bit
is 0 for an integer?

/Jerome



Sat, 16 Jul 2005 22:39:34 GMT  
 bit comparison in integer


Sat, 16 Jul 2005 23:20:40 GMT  
 bit comparison in integer

Quote:

> I'll got no answer on this question two weeks ago so I'll
> try again:

> How do I create in vb-script something that do the same
> as the tsql "&" operator:

> if (MyInteger & 24576 = 16384) then ... end if

> ie checking bitvise if the 15's bit is 1 and the 14's bit
> is 0 for an integer?

And Operator
http://msdn.microsoft.com/library/en-us/script56/html/vsoprand.asp

Windows Script Documentation
http://msdn.microsoft.com/downloads/sample.asp?url=/MSDN-FILES/027/00...

--
Steve

There are two kinds of fool. One says, "This is old, and therefore good." And
one says, "This is new, and therefore better." -John Brunner



Sun, 17 Jul 2005 03:01:32 GMT  
 bit comparison in integer
Hi,

Just for form, in addition to looking at the boolean
operator documentation, consider using parentheses
whenever you use booleans, so you don't have to
rely on the order of operators.  E.g., here you want:

If ((MyInteger AND 24576) = 16384) Then ...

and not:

If (MyInteger AND (24576 = 16384)) Then ...

Joe Earnest



Sun, 17 Jul 2005 03:43:45 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Select Case & Integer Comparisons

2. [VBS] vbscript function to convert 64-bit integer to date value

3. Bit comparison on a Double

4. why do i need bit-wise comparison?

5. Transfer an integer to a Roman Number (I have to rewrite it a bit)

6. Color as an Unsigned 32 bit integer

7. Unsigned 16-bit integers?

8. 32-bit unsigned integer

9. UNSIGNED 16-bit integer, HOW????

10. Need a 16 Bit Integer to ASCII Converter

11. 16 bit integers

12. 64 bit integer?

 

 
Powered by phpBB® Forum Software