delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/06/02/12:27:00

Date: Sat, 02 Jun 2001 19:25:52 +0300
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: "Mark E." <snowball3 AT bigfoot DOT com>
Message-Id: <2950-Sat02Jun2001192551+0300-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9
CC: djgpp-workers AT delorie DOT com
In-reply-to: <3B18BAC2.21715.587E2@localhost> (snowball3@bigfoot.com)
Subject: Re: realloc patch
References: <3B11464B DOT 28287 DOT D7FE4 AT localhost> (snowball3 AT bigfoot DOT com) <3B18BAC2 DOT 21715 DOT 587E2 AT localhost>
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

> From: "Mark E." <snowball3 AT bigfoot DOT com>
> Date: Sat, 2 Jun 2001 10:06:58 -0400
> 
> > However, `realloc_inplace' doesn't use the RET macro (it can't), and
> > doesn't set that LSB either.  It simply returns the block it found
> > with the size and endsz fields intact.
> 
> But the block already has its LSB set since its an allocated block already.

Hmm.. here are the relevant parts of the code:

  after = AFTER(cur);
  after_sz = after->size;
  new_size = (new_size + (ALIGN-1)) & ~(ALIGN-1);
  [...]
    BLOCK *after2 = (BLOCK *)((char *)after + alloc_delta);
    after2->size = after_sz - alloc_delta;
    after2->bucket = -1;
    ENDSZ(after2) = after2->size;
    cur->size += alloc_delta;
    ENDSZ(cur) = cur->size;

So you are saying that "after_size - alloc_delta" and alloc_delta
always have their LSB cleared?  Is that guaranteed for all possible
values of these variables?

- Raw text -


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