For some reason that I can't understand or see these two snippets of code
(below) don't produce the same results! Snippet #2 works while #1 seems to be
off in la-la land dancing with the pixies!
I'd like to use something like what's in snippet #1 as it's shorter code, less
work, and should be faster but....
Any insight?
TIA,
____ _ ____ ____ _____
| _ \ / \ / ___) __ | ___)(_ _)
| |_) / _ \ \____\/ \| _) | |
|____//_/ \_\(____/\__/|_| |_|
www.basicguru.com/schullian
'------------------------------------
'---------- CODE 1
'------------------------------------
DIM B_ptr AS STRING PTR * 255
DIM Block?(254)
B_ptr = VARPTR32( Block?(0) )
ReadCode:
TheCode% = 0
FOR I% = 0 TO CodeSize% - 1
IF BlockIdx% = BlockLen% THEN
GET #FileNo%, , B?
BlockLen% = ( B? * 8 )
BlockIdx% = 0
END IF
IF BIT(Block?(0),BlockIdx%) THEN BIT SET TheCode%,I%
INCR BlockIdx%
NEXT
RETURN
'------------------------------------
'---------- CODE 2
'------------------------------------
DIM B_ptr AS BYTE PTR
DIM Block AS STRING * 255
B_ptr = VARPTR32( Block$ )
ReadCode:
TheCode% = 0
FOR I% = 0 TO CodeSize% - 1
INCR BitsIn%
IF BitsIn% > 7 THEN
BitsIn% = 0
IF BlockIdx% = BlockLen? THEN
GET #FileNo%, , BlockLen?
GET$ #FileNo%, BlockLen?, Block$
BlockIdx% = 0
END IF
INCR BlockIdx%
END IF
IF BIT(B?,BitsIn%) THEN BIT SET TheCode%,I%
NEXT
RETURN