On 8/9/07, Nicolas Cannasse <[EMAIL PROTECTED]> wrote:
> Michael Fellinger a écrit :
> > On 8/6/07, Nicolas Cannasse <[EMAIL PROTECTED]> wrote:
> >>> Hello list,
> >>>
> >>> I have a slight problem here, I'm using a simple stringscanner to
> >>> parse my language, but i cannot parse literal 32bit integer even if i
> >>> handle them internally like that since the only way from string->Int32
> >>> is over $int which cuts the value to 31bit. Same goes for float, there
> >>> is a way to go to float but not from float.
> >> Hello,
> >>
> >> Yes, there's no easy way of doing this right now. But you can write a
> >> string -> int32 converter that will start with 0, then multiply by 10
> >> and add the number for each digit in your string.
> >>
> >> Maybe a float -> int32 function would help here.
> >> I just modified int32_new on CVS so it can accept a float.
> >>
> >
> > Thanks for that, in the meanwhile i am using: http://pastie.caboo.se/86027
> > As you can see it's not very performant, the first bytes could be
> > converted by $int, but just as a quick and dirty solution it works
> > fine.
>
> Using lpos += 1 instead of $iadd will help a bit ;)

That is one of the points i haven't found docs on, though i know that
it works, i was just under the impression that the $i* functions are
generally faster when handling ints?

^ manveru
-- 
Neko : One VM to run them all
(http://nekovm.org)

Reply via email to