there are no excel function for binary arithmatic.
you have to create VBA user defined functions.
Instead of using VBA math and binary operators
I'd go the API way...
Note: Be carefull with creating your own derivatives
with copymemory, certainly with "As Any" syntax.
Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory"
( _
ByRef Destination As Any, ByRef Source As Any, ByVal Length As Long)
Function HiWord(ByVal dw As Long) As Integer
CopyMemory HiWord, ByVal VarPtr(dw) + 2, 2
End Function
Function LoWord(ByVal dw As Long) As Integer
CopyMemory LoWord, ByVal VarPtr(dw), 2
End Function
Function MakeWord(ByVal HiWord As Integer, _
ByVal LoWord As Integer) As Long
CopyMemory ByVal VarPtr(MakeWord) + 2, HiWord, 2
CopyMemory ByVal VarPtr(MakeWord), LoWord, 2
End Function
--
keepITcool
|
www.XLsupport.com | keepITcool chello nl | amsterdam
Mike Hodgson wrote :
A small clarification - I mean in a cell formula rather than VBA.
--
*mike hodgson* |/ database administrator/ | mallesons stephen jaques
*T* +61 (2) 9296 3668 |* F* +61 (2) 9296 3885 |* M* +61 (408) 675 907
*E* |* W*
http://www.mallesons.com
Mike Hodgson wrote:
How do you do binary operations like left shift, right shift,
binary and, binary or, exclusive or, etc. I'd like to essentially
do this (basic C calculations) in Excel:
x = a 32; // (left shift by 32 bits)
y = a & 0xFFFFFFFF; // (binary AND; i.e. bit mask)
I'm basically trying to get the high-order & low-order DWORDs from
a 64-bit int.
--
*mike hodgson* |/ database administrator/ | mallesons stephen jaques
T +61 (2) 9296 3668 |* F* +61 (2) 9296 3885 |* M* +61 (408) 675 907
E |* W*
http://www.mallesons.com