Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. uint40

uint40

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++phphardwareworkspace
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Victor Boctor
    wrote on last edited by
    #1

    Hi, I need to implement uint40, where the compiler I am using (in an embedded environment) only supports up to uint32. It would be interesting to have a look at C++ implementations (or even C) for int40 or int64. The only one I found was the Putty C implementation of int64. Regards, Victor phpWebNotes is a page annotation system modelled after php.net. http://webnotes.sourceforge.net/demo.php[^]

    J M 2 Replies Last reply
    0
    • V Victor Boctor

      Hi, I need to implement uint40, where the compiler I am using (in an embedded environment) only supports up to uint32. It would be interesting to have a look at C++ implementations (or even C) for int40 or int64. The only one I found was the Putty C implementation of int64. Regards, Victor phpWebNotes is a page annotation system modelled after php.net. http://webnotes.sourceforge.net/demo.php[^]

      J Offline
      J Offline
      Joaquin M Lopez Munoz
      wrote on last edited by
      #2

      __int64 is a built-in type in VC++. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

      1 Reply Last reply
      0
      • V Victor Boctor

        Hi, I need to implement uint40, where the compiler I am using (in an embedded environment) only supports up to uint32. It would be interesting to have a look at C++ implementations (or even C) for int40 or int64. The only one I found was the Putty C implementation of int64. Regards, Victor phpWebNotes is a page annotation system modelled after php.net. http://webnotes.sourceforge.net/demo.php[^]

        M Offline
        M Offline
        MAAK
        wrote on last edited by
        #3

        Am not sure if this might help, but it need a good Assembly programmer(I barely know it myself). This is how VC++ implement the __int64 using Assembly, remember that all processors register are 32 (except 64 bit CPU of course) and all operations are done on them at the processor level. Anyway these are C++ statements with corresponding Assembly, it you may be able to implement using Assembly.

        	__int64 l1, l2, l3;
        	l1 = 256;
        00417053  mov         dword ptr [l1],100h 
        0041705A  mov         dword ptr [ebp-14h],0 
        	l2 = 128;
        00417061  mov         dword ptr [l2],80h 
        00417068  mov         dword ptr [ebp-24h],0 
        	l3 = l1 + l2;
        0041706F  mov         eax,dword ptr [l1] 
        00417072  add         eax,dword ptr [l2] 
        00417075  mov         ecx,dword ptr [ebp-14h] 
        00417078  adc         ecx,dword ptr [ebp-24h] 
        0041707B  mov         dword ptr [l3],eax 
        0041707E  mov         dword ptr [ebp-34h],ecx 
        	l3 = l1 - l2;
        00417081  mov         eax,dword ptr [l1] 
        00417084  sub         eax,dword ptr [l2] 
        00417087  mov         ecx,dword ptr [ebp-14h] 
        0041708A  sbb         ecx,dword ptr [ebp-24h] 
        0041708D  mov         dword ptr [l3],eax 
        00417090  mov         dword ptr [ebp-34h],ecx 
        	l3 = l1 * l2;
        00417093  mov         eax,dword ptr [ebp-24h] 
        00417096  push        eax  
        00417097  mov         ecx,dword ptr [l2] 
        0041709A  push        ecx  
        0041709B  mov         edx,dword ptr [ebp-14h] 
        0041709E  push        edx  
        0041709F  mov         eax,dword ptr [l1] 
        004170A2  push        eax  
        004170A3  call        @ILT+1330(__allmul) (411537h) 
        004170A8  mov         dword ptr [l3],eax 
        004170AB  mov         dword ptr [ebp-34h],edx 
        	l3 = l1 / l2;
        004170AE  mov         eax,dword ptr [ebp-24h] 
        004170B1  push        eax  
        004170B2  mov         ecx,dword ptr [l2] 
        004170B5  push        ecx  
        004170B6  mov         edx,dword ptr [ebp-14h] 
        004170B9  push        edx  
        004170BA  mov         eax,dword ptr [l1] 
        004170BD  push        eax  
        004170BE  call        @ILT+5340(__aulldiv) (4124E1h) 
        004170C3  mov         dword ptr [l3],eax 
        004170C6  mov         dword ptr [ebp-34h],edx 
        	l3 = l1 % l2;
        004170C9  mov         eax,dword ptr [ebp-24h] 
        004170CC  push        eax  
        004170CD  mov         ecx,dword ptr [l2] 
        004170D0  push        ecx  
        004170D1  mov         edx,dword ptr [ebp-14h] 
        004170D4  push        edx  
        004170D5  mov         eax,dword ptr [l1] 
        004170D8  push        eax  
        004170D9  call        @ILT+5345(__aullrem) (4124E6h) 
        004170DE  mov         dword ptr [l3],eax 
        004170E1
        
        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups