Page 2 of 2

Re: LibUnsigned: unsigned ops for 32-bit dword & 64-bit quad

Posted: Fri Jul 29, 2016 6:50 am
by wilbert
Keya wrote:now in "SUPERMODULAR" form!!!
Nice work Keya 8)
Keya wrote:All tests looked good on my Win/Linux/OSX x86 + x64 systems, please run TestAll32.pb and TestAll64.pb and you should see "All tests passed" at the bottom of Debug window output.
Works fine :)

Re: LibUnsigned: unsigned ops for 32-bit dword & 64-bit quad

Posted: Thu Dec 16, 2021 11:30 am
by Keya
now that PB has a C backend I would love it if this library could be made redundant by a native unsigned 32bit/64bit datatype :)

Re: LibUnsigned: unsigned ops for 32-bit dword & 64-bit quad

Posted: Thu Dec 16, 2021 10:11 pm
by idle
I suspect it can be done now in the c backend but I can't figure out how to get it to work with procedures :cry:

Code: Select all

;pbcompilerc -d Unsigned.pb 

CompilerIf #PB_Compiler_Backend = #PB_Backend_C 
!unsigned int v_a =0;  
!unsigned int v_b =0;
CompilerEndIf 

Global a.l, b.l,c.l,d.l 

a = 4294967295 ;a is unsigned 
c = 4294967295 ;c is signed  

b = a / 2

If a > b 
  Debug "a is unsigned"
Else 
  Debug "a is signed"
EndIf   

Debug a 
Debug b 

d = c / 2 

If c > d 
  Debug "c is unsigned"
Else 
  Debug "c is signed"
EndIf   

Debug c 
Debug d  

Re: LibUnsigned: unsigned ops for 32-bit dword & 64-bit quad

Posted: Fri Dec 17, 2021 9:53 pm
by idle
Think I've got this figured out now.

https://www.purebasic.fr/english/viewtopic.php?t=78386