[retroforth] Re: ztype in assembler

  • From: "Helmar Wodtke" <helmwo@xxxxxx>
  • To: retroforth@xxxxxxxxxxxxx
  • Date: Wed, 26 Jan 2005 22:58:16 +0100

retroforth@xxxxxxxxxxxxx schrieb am 26.01.05 22:49:27:
> 
> 
> On Wed, January 26, 2005 13:30, Helmar Wodtke said:
> > retroforth@xxxxxxxxxxxxx schrieb am 26.01.05 22:20:57:
> > With a shorter loop:
> >
> >> ; ----------------------------------------------------------------------
> >> code 'ztype',ztype
> >>         push ebx                ;
> >>         push ecx                ;
> >>         upop ebx                ;
> >>         lea ecx, byte [ebx - 1]
> >> .a:     inc ecx
> >>         cmp byte [ecx], 0
> >>         jnz .a
> >>         sub ecx,ebx
> >>         jmp type.a
> >> ; next
> >
> > Ron, expert :) Faster?
> >
> 
> Dunno.  I have a 'ztc' word which takes a zstr and returns a forth 
> string/count
> 
> Zstring ztc type
> 
> ; ( zstr -- zstr len )
> code 'ztc', _ztc
>  push eax ; save ptr
>  mov edi, eax
>  xor eax, eax
>  mov ecx, -1
>  repne scasb
>  pop eax
>  sub edi, eax
>  dec edi
>  upsh edi
> next
> 
> I haven't tried to make it smaller or faster yet...
I dont know too... I've heard rumors that block-instructions are on some 
processors much slower than explicit operations (I dont know why it should be 
so...) Well, I would prefer your solution of having a "ztc": an explicit 
"ztype" could help only to avoid some calling overhead, but the most overhead 
should be produced by "emit".

Bis dann,
Helmar
helmwo@xxxxxx


-- Binary/unsupported file stripped by Ecartis --
-- Type: application/x-pkcs7-signature
-- File: smime.p7s
-- Desc: S/MIME Cryptographic Signature



Other related posts: