DISK SIZE

 BBS: Inland Empire Archive
Date: 01-19-93 (14:25)             Number: 324
From: CORIDON HENSHAW              Refer#: NONE
  To: ROB MCKEE                     Recvd: NO  
Subj: DISK SIZE                      Conf: (2) Quik_Bas
Hello Rob!

In a msg of <16 Jan 93>, Rob Mckee writes to Keith Watkins:

 RM> FUNCTION Int2Long& (TheInt%)
 RM> IF TheInt% < 0 THEN Int2Long& = TheInt% + 65536 ELSE Int2Long& =_
 RM> TheInt%
 RM> END FUNCTION

C'mon!  You can do better than that ;)
===Chop===
'H2T 1.0
DEFINT A-Z:OPEN "B",#1,"CVTLONG.OBJ":OPEN "B",#2,"H"
DO:READ I$:IF I$="-1" THEN EXIT DO
PUT #2,,I$:LOOP:I$="  ":SEEK #2,1:DO UNTIL LOC(2)=LOF(2):GET #2,,I$
O$ = CHR$(VAL("&H"+I$)):PUT #1,, O$: LOOP:CLOSE:KILL "H"
DATA 800D000B6376746C6F6E672E61736DFC96260000064447524F55500C4356544C4F4E47
DATA 5F54455854044441544104434F4445055F44415441E5980700481400030501FC980700
DATA 4800000604010E9A040002FF025F900E000001074356544C4F4E470000003D88040000
DATA A201D1A01800010000558BEC57561E068B460633D2071F5E5F5DCA0200C28A02000074
DATA -1
===Chop===

Calling syntax is:

===Chop===
DECLARE FUNCTION CVTLong& (BYVAL SignedInteger%)

'SignedInteger% = QB/PDS INTEGER
'Returns: unsinged integer in form of a LONG
===Chop===

The above code is 100% ASM, and VERY fast.

\  Coridon Henshaw  \          ³
  \  Sirrus Software  \      \ ³ /
    \   Sysop,          \  ÄÄÄÄ*ÄÄÄÄ
      \  TCS Concordia    \  / ³ \
        \  34:3416/18       \  ³

...Detour: The roughest distance between two points.

--- GEcho 1.00
 * Origin: Politicly INcorrect and damn proud of it (1:250/820)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET