[SLOF] [PATCH v2] fat-files: Fix access to FAT32 dir/files when cluster > 16-bits

Segher Boessenkool segher at kernel.crashing.org
Thu Jun 9 18:21:42 AEST 2016


On Thu, Jun 09, 2016 at 09:35:42AM +0200, Thomas Huth wrote:
> >  : (find-file) ( -- cluster file-len is-dir? true | false )
> >    data @ BEGIN dup data @ #data @ + < WHILE
> >    dup dos-name b comp WHILE 20 + REPEAT
> > -  dup 1a + 2c@ bwjoin swap dup 1c + 4c@ bljoin swap 0b + c@ 10 and 0<> true
> > +  dup get-cluster
> > +  swap dup 1c + 4c@ bljoin swap 0b + c@ 10 and 0<> true
> >    ELSE drop false THEN ;
> 
> Unrelated to your patch, but: WTF? Where's the IF-statement for that
> ELSE? ... must be some magic code by Segher again ... ;-)

Heh.  Nothing magic, just

BEGIN ... WHILE ... WHILE ... REPEAT ... ELSE ... THEN

1:  BEGIN
     ...
    WHILE   \ if 0, goto 3
     ...
    WHILE   \ if 0, goto 2
     ...
    REPEAT  \ goto 1
2:   ...
    ELSE    \ goto 4
3:   ...
    THEN
4:

so just an indeterminate loop with two exits.


Segher


More information about the SLOF mailing list