delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2015/06/27/06:14:14

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
X-Cam-AntiVirus: not scanned (internal relaying)
X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/
MIME-Version: 1.0
X-Authenticated-User: pcjc2
Date: Sat, 27 Jun 2015 11:12:59 +0100
From: "Peter C.J. Clifton" <pcjc2 AT cam DOT ac DOT uk>
To: geda-user AT delorie DOT com
Subject: Re: [geda-user] [RFC][PATCH] PCB: Allow non rounded clearances for
rectangular/square pins and pads
In-Reply-To: <20150625233042.GA32022@visitor2.iram.es>
References: <20150625163731 DOT GA18117 AT visitor2 DOT iram DOT es>
<1435268559 DOT 24445 DOT 13 DOT camel AT cam DOT ac DOT uk>
<20150625233042 DOT GA32022 AT visitor2 DOT iram DOT es>
Message-ID: <4f11772b1f791b161f8fd0109381f985@cam.ac.uk>
X-Sender: pcjc2 AT cam DOT ac DOT uk
User-Agent: Roundcube Webmail/1.0.2
Reply-To: geda-user AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: geda-user AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On 2015-06-26 00:30, Gabriel Paubert (paubert AT iram DOT es) wrote:
> I've not changed any internal API at all yet. For now the patches in
> this area boil down to these modifications in the structure 
> definitions:
> 
> 
> diff --git a/src/polyarea.h b/src/polyarea.h
> index 43fd93d..f63e83d 100644
> --- a/src/polyarea.h
> +++ b/src/polyarea.h
> @@ -82,8 +82,8 @@ struct VNODE
>  {
>      VNODE *next, *prev, *shared;
>      struct {
> -      unsigned int status:3;
> -      unsigned int mark:1;
> +      unsigned char status;
> +      unsigned char mark;
>      } Flags;
>      CVCList *cvc_prev;
>      CVCList *cvc_next;
> @@ -96,15 +96,15 @@ struct PLINE
>      Coord xmin, ymin, xmax, ymax;
>      PLINE *next;
>      VNODE head;
> -    unsigned int Count;
>      double area;
>      rtree_t *tree;
> -    bool is_round;
>      Coord cx, cy;
>      Coord radius;
> +    unsigned int Count;
> +    bool is_round;
>      struct {
> -      unsigned int status:3;
> -      unsigned int orient:1;
> +      unsigned char status;
> +      unsigned char orient;
>      } Flags;
>  };
> 
> The reasons are:
> - when the structure size is at least a multiple of 4 bytes (32 bit),
>   and more likely 8 (64 bit machines and some 32 bit because there is
>   a double in there), it is stupid to use 2 bit fields when two
>   unsigned char fields will do (extracting from bit fields and
>   especially assigning to is more expensive).

Granted.. bitfields are ugly here. I didn't realise we used them.

> - the is_round field in the middle of PLINE is very wasteful for
>   alignment.

I put that there.. next to the coordinates (to be close to the variables 
it makes sense with).

Great to move these, and with our piecewise linear circular circular 
approximations, we do get a lot of VNODEs.
I would, however, be surprised if this makes any measurable difference 
in speed, but I might be wrong.

> I'm not sure for the area field , IIRC the alignment of doubles depends
> on the ABI for 32 bit architectures and anyway 64 bit is what really 
> matters
> these days.

Agreed.


Let me know if your shorted sliver cases is fixed by any (combination) 
of my patches. I suspect they will.

Best wishes,

Peter

- Raw text -


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