RE: Supercharge your peek_string()
- Posted by Al Getz <Xaxo at aol.com> Apr 29, 2001
- 404 views
Matthew Lewis wrote: > > --- Al Getz <Xaxo at aol.com> wrote: > > > This new way of peek'ing a zstring is typically > > at least 5 times faster then the old way, and its > > only one line of code > > Actually, the number of bytes are stored in the four bytes before > the pointer > to the string. > > ===== > Matt Lewis > http://www14.brinkster.com/matthewlewis > > Hi Matt, I couldnt establish a relationship between the four bytes preceding the lpString and the length of the string, other then a loose one. I tried a few times or so and didnt get reasonable results. Heres basically what i tried: atom lpString, Possibly_Length_Of_String sequence text text="this string" lpString=allocate_string(text) Possibly_Length_Of_String=peek4u(lpString-4) ?length(text) ?Possibly_Length_Of_String Is this what you were talking about? I always get two different numbers printed out. Changing the length of the string by one character doesnt always even change the second value printed out. Is there another trick to it? --Al