05-24-2005, 05:05 AM
05-24-2005, 05:22 AM
Quote:I request you remove me as winner.
Ok, Z!re, poof, you're no longer the winner. Mango and Blitz move up one position in the ranking.
*****
05-24-2005, 05:29 AM
Quote:Ok, but you have to do some work. Write, and post, a test program using your solution, that prints onto a workfile every value from -32767 tp 32766 on individual lines, and on the same line prints the resultant value which has been shifted left and rotated 2 bits.Moneo Wrote:LOGICLRD, the challenge had already been closed.
*****
So re-open it :-) The current winner clearly does not wish to hold the title.
I should then be able to take your test program, compile it, and run it producing the workfile. I'll then examine the workfile and make sure the results are correct.
*****
05-24-2005, 05:43 AM
If you had told me that you wasn't using the IDE it could have posted simpler and faster code. I thought having it run in the IDE was one of the requirments. But whatever, i'm done with this challenge.
05-24-2005, 06:10 AM
Quote:Ok, but you have to do some work. Write, and post, a test program using your solution, that prints onto a workfile every value from -32767 tp 32766 on individual lines, and on the same line prints the resultant value which has been shifted left and rotated 2 bits.
What is the exact format you want for this? Here are a few possibilities:
-32767 6
-32767 => 6
-32767 , 6
Before: -32767 After: 6
I will post the test program once you tell me what the format should be :-)
05-24-2005, 06:28 AM
How about:
010100101101001 -> 010010110100101
And my name is still there, as the winner.
010100101101001 -> 010010110100101
And my name is still there, as the winner.
05-24-2005, 07:43 AM
Nice avtar, really nice, really
05-24-2005, 09:38 AM
i'd say zires avatar is the winner, no really
05-24-2005, 10:54 PM
logiclrd,
A simple format is fine, like:
print #1, input.value , result.value
where input.value and result.value are integers, and #1 is the workfile opened for output.
*****
A simple format is fine, like:
print #1, input.value , result.value
where input.value and result.value are integers, and #1 is the workfile opened for output.
*****
05-25-2005, 04:37 AM
Code:
DECLARE SUB ROL2 (a%)
DECLARE SUB ROL2ASM (a%)
' Set to 1 in order to test the CALL ABSOLUTE implementation.
CONST UseCallAbsoluteVersion% = 0
' The message board post clearly stated that values from -32767
' to +32766 should be used. However, an INTEGER can also store the
' values -32768 and +32767. To test the full range, set this to 0.
CONST SkipMinAndMax% = 1
DIM SHARED shiftLeft%(255), shiftRight%(255)
IF UseCallAbsoluteVersion% = 0 THEN
OPEN "ROL2POKE.TXT" FOR OUTPUT AS #1
' These lookup tables are only used in SUB ROL2, and not SUB ROL2ASM
FOR i% = 0 TO 255
shiftLeft%(i%) = (i% * 4) AND 255
shiftRight%(i%) = i% \ 64
NEXT i%
ELSE
OPEN "ROL2ASM.TXT" FOR OUTPUT AS #1
END IF
FOR i& = -32768 + SkipMinAndMax% TO 32767& - SkipMinAndMax%
a% = i&
PRINT #1, a%,
IF UseCallAbsoluteVersion% = 0 THEN ROL2 a% ELSE ROL2ASM a%
PRINT #1, a%
NEXT i&
CLOSE #1
SUB ROL2 (a%)
DEF SEG = VARSEG(a%)
ptr% = VARPTR(a%)
l% = PEEK(ptr%)
h% = PEEK(ptr% + 1)
POKE ptr%, shiftLeft%(l%) OR shiftRight%(h%)
POKE ptr% + 1, shiftLeft%(h%) OR shiftRight%(l%)
END SUB
SUB ROL2ASM (a%)
DIM code&(3)
code&(0) = -1959337079: code&(1) = 126551135
code&(2) = -1059913039: code&(3) = 13305737
DEF SEG = VARSEG(code&(0))
CALL ABSOLUTE(a%, VARPTR(code&(0)))
END SUB