delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/01/10/17:23:55

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
Message-Id: <10201102223.AA16574@clio.rice.edu>
Subject: Re: Proposed lstat.c patch for Win2000/XP device bit fix
To: djgpp-workers AT delorie DOT com
Date: Thu, 10 Jan 2002 16:23:34 -0600 (CST)
Cc: rich AT phekda DOT freeserve DOT co DOT uk
In-Reply-To: <3C3DE9D2.6CBD2255@phekda.freeserve.co.uk> from "Richard Dawe" at Jan 10, 2002 07:21:54 PM
X-Mailer: ELM [version 2.5 PL2]
Mime-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> > Isn't this code always included in the image. IIRC, the recommendation
> > is to use ff_blk.lfn_magic[0] == 'F' && ff_blk.lfn_magic[0] == 'A' &&
> > ... if so.
> 
> Why is this recommended? (I had a look through the thread, but I couldn't
> see the answer.) Surely the program size overhead of strcmp() vs. explicit
> comparison can't be that great.

Facts:
 1) -O2 -s shows that strcmp is inlined here.  The LFN32 takes 6 bytes of
    space, the code take 23 bytes for the inlined rep cmpsb for a total of
    29 bytes in 7 instructions.
 2) -O2 -s shows the replacement code takes 22 bytes (a savings of 7 bytes
    per instance) in 4 instructions.

I just don't think the grand total of 28 bytes in the 4 places are worth
the code changes.  I think we should just use the strcmp and forget it.
(Remember, the original idea here was to fix stat for devices on W2K ...).

> Also, I have a historical question: why was a 6 byte string magic field
> chosen, instead of some integer bitfield for options?

I don't know, but I don't think we should change it now.  I don't know if
any user programs check this - but it's been documented and available for
a long time, the overhead is small.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019