I am running Sharepoint 2007 farm and am trying to calculate user permissions. I have read [This](https://stackoverflow.com/questions/1431439/ows-permmask-in-sharepoint-webservices) post about the particular metadata field where I am getting my mask from. And I have been looking at [The following](http://msdn.microsoft.com/en-us/library/cc704409.aspx) guide in order to see what masks I need to compare to.

Here is my delima, whenever I run the following code in a IE javascript console I get back 0:

```
((0x4000000000000000).toString(16) & (0x400001F07FFF1BFF).toString(16))

```

Now I know this is incorrect because the respective binary values are:

```
100000000000000000000000000000000000000000000000000000000000000
100000000000000000000011111000001111111111111110001101111111111

```

Which should equal

```
100000000000000000000000000000000000000000000000000000000000000

```

I have also put this into my windows calculator just to make sure I wasn't crazy (and to get those super long binary numbers).

**NOTE** 
As I got to this line I realized that my browser is 32bit (which is a requirement for the site I am using this on) and this is a 64 bit number!

How can I (preferably in one line) calculate the bitwise AND of a two 64bit numbers using a 32bit browser?

I do know that I could convert the number into a binary String and utilize a loop to check each bit but is there a simpler method?

**EDIT - Solution**
Utilizing the information from [This Post](https://stackoverflow.com/questions/2983206/bitwise-and-in-javascript-with-a-64-bit-integer) and the answer below I came up with the following solution:

```
     var canEdit = false;
var canEditMask = [0x00000000,0x00000004];
var canApprove = false;
var canApproveMask = [0x00000000,0x00000010];
var canRead = false;
var canReadMask = [0x00000000,0x00000001];
var canDesign = false;
var canDesignMask = [0x00000000,0x00000800];
var mask = [originalmask.substring(0,10).toString(16),
                  ("0x"+itemperms.substring(9)).toString(16)];
canEdit = (mask[0] & canEditMask[0]) >0 || (mask[1] & canEditMask[1]) >0;
canRead = (mask[0] & canReadMask[0]) >0 || (mask[1] & canReadMask[1]) >0;
canDesign = (mask[0] & canDesignMask[0]) >0 || (mask[1] & canDesignMask[1]) >0;
canApprove = (mask[0] & canApproveMask[0]) >0 || (mask[1] & canApproveMask[1]) >0;

```