Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Large Bitmask operation

Reply
 
Old 05-22-2009   #1 (permalink)
Remy


 
 

Large Bitmask operation

I use bitmasks in tandem with MS SQL Server, used for access permissions but
also option lists.

I have used this for many years happily. I now have the situation were an
option list which was supposed to contain a few items (easily enumerated)
will potentially have to hold 100s of items.

My issue is that VBScript will not be able to operate on these large numbers
as they will be beyond any numeric type inherent in VBScript. I could use a
binary varchar in SQL to store values but have the problem of using bitwise
comparision in VBScript.

I'm sure there must be a way of checking sizes and cutting up the binary
into manageable chunks but I have no idea even how to attempt this.

I've read some stuff on SQL managing this type of thing but I need a VBS
solution.

All help is appreciated.

My System SpecsSystem Spec
Old 05-22-2009   #2 (permalink)
Richard Mueller [MVP]


 
 

Re: Large Bitmask operation

Remy wrote:
Quote:

>I use bitmasks in tandem with MS SQL Server, used for access permissions
>but
> also option lists.
>
> I have used this for many years happily. I now have the situation were an
> option list which was supposed to contain a few items (easily enumerated)
> will potentially have to hold 100s of items.
>
> My issue is that VBScript will not be able to operate on these large
> numbers
> as they will be beyond any numeric type inherent in VBScript. I could use
> a
> binary varchar in SQL to store values but have the problem of using
> bitwise
> comparision in VBScript.
>
> I'm sure there must be a way of checking sizes and cutting up the binary
> into manageable chunks but I have no idea even how to attempt this.
>
> I've read some stuff on SQL managing this type of thing but I need a VBS
> solution.
>
Aren't your integers going to be larger than 10^30, or do I figure wrong?
VBScript can represent integers up to 2^53 exactly, but the AND, OR, and XOR
functions overflow at 2^31. If I understand correctly, this allows for maybe
30 values (different bit masks). If you coded your own bitwise functions in
VBScript you might be able to handle 50 values. I thought SQL Server could
handle integers up to 2^64, which doesn't appear to be large enough to
handle 100 values.

The only method I know of to break up large numbers is the IADsLargeInteger
interface provided by ADSI. This interface has a HighPart and LowPart method
that breaks up 64-bit integers into two 32-bit values. However, this is only
available for Active Directory Integer8 attributes. And even if you could
use it, I don't see where this would accomodate 100's of values.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
This operation has been cancelled Vista General
The Operation Failed Microsoft Office
Moving a large .avi file - "file too large" message General Discussion
this operation has ........................:| General Discussion
Mouse operation Vista installation & setup


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46