either I'm a complete jerk or isn't this code here:
val+=SvIV(Inline_Stack_Item(len-i-1))*ex;
a problem?  Are you trying to loop through the var
stack backwards or ??  I don't think you're getting the
values you expect to find at your specified index... good luck.

-nw

On 5/10/05, Soós Máté <[EMAIL PROTECTED]> wrote:
> Hi!
> 
> Have a look at this snippet of code:
> 
> SV* parse_hex (SV* name1,...) {
>   Inline_Stack_Vars;
>   int i,len;
>   long long int ex, val;
>   val=0;
>   len=Inline_Stack_Items;
> 
>   char str[100];
> 
>   for(i=0;i<len ;i++) {
>     ex=pow(256,i);
>     val+=SvIV(Inline_Stack_Item(len-i-1))*ex;
>     printf("ex=%lli, val=%lli, len=%i\n", ex, val,len);
>   }
>   return newSVpvf("%ill", val);
> }
> 
> You would think it worked... but it doesn't! And why? Because the "%ill" 
> conversion does NOT work correctly, it wants to write an int (or long int, 
> dunno) instead, and it gives me back stupid numbers (however, when I write it 
> to the console, i.e. printf, it gives me the right number). The solution is:
> 
>   char str[100];
>   sprintf(str,"%lli",val);
>   return newSVpvf("%s", str);
> 
> (this works 100% correctly)
> 
> which is funny, because it slows it down a LOT. I am absolutely sure this is 
> a bug. Please correct it!
> 
> 
> Máté Soós
> 
>

Reply via email to