[Implemented] Quads and doubles

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

[Implemented] Quads and doubles

Post by BackupUser »

Restored from previous forum. Originally posted by Rings.

Today i want to convert some stuff(From PowerBasic) to Pure but have to halt while Pure has'nt support for Quads.But some API-Functions need this.
First we can use Structures to do some stuff, but we also have to need any calculations with Quads(simple * or / ).I have also study the LCC docs and found out that
LCC can use DoubleLongs(8 Bytes = Quads) So it can't been so difficult to implement some Wrapperfunctions for that.
And don't to Forget to remember the Doubles already.......
I think that can or Must been that Topic for a next version Fred.....

;Some Example Code, and only example Code :

#FULLDAY = 24 * 60 * 60 * 10000000

Structure LARGETIME
qTime.QUAD
EndStructure

GLOBAL st AS SYSTEMTIME
GLOBAL lt AS LARGETIME

FUNCTION DateSerial(wYear.w, wMonth.w, wDay.w)
st\wYear = wYear
st\wMonth = wMonth
st\wDay = wDay
SystemTimeToFileTime_( st, lt)
L1 = lt\qTime \ #FULLDAY + 1 ; base = 1
ProcedureReturn L1
EndProcedure

Procedure Year(SerialDate)
If SerialDate = 0
GetLocalTime st
Else
SerialDate - 1 ; Return To base = zero
lt\qTime = SerialDate * #FULLDAY
FileTimeToSystemTime_( lt, st)
EndIf
ProcedureReturn st\wYear
EndProcedure

Its a long way to the top if you wanna .....CodeGuru