![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
Putting a 64 bit word into two 32 bit registers and vice versaThis is one of those simple questions that is going to embarrass me once I know the answer but here goes
I want to use 64 bit words in VC++ as follows eg __int64 iTest=0xAAAABBBBCCCCDDDD; I then want to very simply put iTest into a couple of 32 bit registers using inline asm so that, for example, eax == AAAABBBB and edx = CCCCDDDD I then want to mess with eax and edx (eg doing shifts) and then put them back into iTest Speed is absolutely crucial as this is part of a program that will run for days if i am not careful Many thanks Bob Edit PS I note that the disassembler does the following 323: __int64 i64Test=0xaaaabbbbccccdddd; 10003FE8 mov dword ptr [ebp-18h],0CCCCDDDDh 10003FEF mov dword ptr [ebp-14h],0AAAABBBBh so I guess that is the answer (ie copy the memory locations to the registers) Edit PPS This does it: __int64 iTest=0xaaaabbbbccccdddd; __int64 *iptTest=&iTest; _asm{ mov ecx, iptTest mov edx, [ecx] mov eax, [ecx+4] } Anybody got anything quicker or more elegant? |
|||
|
#2
|
|||
|
|||
Re: Putting a 64 bit word into two 32 bit registers and vice versaI think I have got this sussed now. There is very little stuff on the web re __int64 and inline asm so this may be helpful to somebody one day
Code:
Call it like this Code:
I find passing pointers to function calls a bit tricky as it seems to me that if you declare a pointer "eg int * ptrPointer" it doesn't exist until it does something so function calls don't seem to work if you do the following: Code:
The above version of Long64BitIntTo32BitIntsLocal is deliberately complicated to show the use of pointers in asm! This is an easy version of Long64BitIntTo32BitIntsLocal Code:
|
Recent GIDBlog
Programming ebook direct download available by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The