64bit - 32-bit C++ to 64-bit C++ using Visual Studio 2010 -


i want convert 32-bit c++ project 64-bit, stuck first try. point out suggestions/checklist/points when converting 32-bit c++ 64-bit in vs (like converting 32-bit delphi 64-bit).

int getvendorid_0(char *pvendorid,int ilen) { #ifdef win64  // why win64 not defined switching active (x64) ?     // put here? #else     dword   dwa,dwb,dwc,dwd;     __asm     {         pushad         mov     eax,0         cpuid   //cpuid(eax=0),         mov     dwa,eax         mov     dwc,ecx         mov     dwd,edx         mov     dwb,ebx         popad     }     memset( pvendorid,      0,ilen);     memcpy( pvendorid,      &dwb,4);     memcpy(&pvendorid[4],   &dwd,4);     memcpy(&pvendorid[8],   &dwc,4);     return dwa; #endif } 

microsoft's compilers (some of them, anyway) have flag point out @ least common problems code need modification work 64-bit code.

as far getvendorid_0 function goes, i'd use microsoft's _cpuid function, this:

int getvendorid_0(char *pvendorid, int ilen) {      dword data[4];      _cpuid(0, data);     memcpy(pvendorid, data+1, 12);     return data[0]; } 

that doesn't replace instances of inline assembly language. choices simple (though not easy). 1 find intrinsic job. other move assembly code separate file , link code in c++ (and learn x64 calling convention). third forego you're doing now, , write closest equivalent can more portable code.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -