Staz Software
HomeFutureBasicSharewareOrderContact

Tech Notes

Unsigned Wide Variables

Many of the new structures in Appledom include 64 bit integers which makes them twice the size of our long integer vars. The following routines show how to convert an unsigned 64 bit integer to a double precision floating variable and back.

BEGIN RECORD UnsignedWide
 DIM hh AS UNSIGNED WORD
 DIM hl AS UNSIGNED WORD
 DIM lh AS UNSIGNED WORD
 DIM ll AS UNSIGNED WORD
END RECORD

LOCAL MODE
LOCAL FN UnsignedWideToDbl#(WidePtr AS PTR TO UnsignedWide)
END FN = ((((WidePtr.hh*65536.0)+WidePtr.hl)*65536.0) ¬
+WidePtr.lh)*65536.0+WidePtr.ll

LOCAL MODE
LOCAL FN DblToUnsignedWide(Dbl#,WidePtr AS PTR TO UnsignedWide)
 WidePtr.hh =  (Dbl# / 281474976710656.0)
 Dbl# = Dbl# - (WidePtr.hh * 281474976710656.0)
 WidePtr.hl = Dbl# / 4294967296
 Dbl# = Dbl# - (WidePtr.hl * 4294967296)
 WidePtr.lh = Dbl# / 65536.0
 Dbl# = Dbl# - (WidePtr.lh * 65536.0)
 WidePtr.ll = Dbl#
END FN

FutureBASIC

Demo

Order

Tour

Tech Notes

FAQ

Sample Code

Web Sites

Mailing List

System
Requirements

blank