"John R. Hogerhuis" <jho...@pobox.com> wrote: > 10 DEFINTP:DEFSTRH > 20 H=CHR$(201) > 30 P=VARPTR(H)+1 > 1000 P=PEEK(P)+256%*(PEEK(P+1)+256%*(PEEK(P+1)>127)) > 1010 PRINTP
Very nice. That seems a little more optimized than the solution I used for my "direct file access from RAM" implementation :o) You could skip the second multiplication by using AND instead: 1000 P=PEEK(P)+256%*(PEEK(P+1)-(PEEK(P+1)>127AND256)) (Note that the sign has been reversed) but... somehow the execution time isn't really impacted (I suppose multiplying by -1 is fast) FWIW, I also tried "caching" the result of "PEEK(P+1)" but again, it didn't change the result (in all 3 implementations, 1000 iterations took 14 seconds, so those modifications aren't really interesting, except for the brain picking exercise ;o)). If I may ask a question, I almost dever used DEFINT and DEFSTR: I just use "%" or "$" prefixes for my variables. Are DEFINT and DEFSTR faster or is this a question of personal preferences? I kind of like that I can tell the type of variables by their name, but if the other solution gives a performance boost I'm ready to reconsider. Eric