On Wed, 2009-09-02 at 10:58 -0600, tom fogal wrote:
> writes:
> > On Wed, 2009-09-02 at 09:05 -0700, Keith Whitwell wrote:
> > > On Wed, 2009-09-02 at 08:48 -0700, Jos Fonseca wrote:
> > > > On Wed, 2009-09-02 at 05:11 -0700, Chris Wilson wrote:
> > > > > By rearranging the bitfields within the key we can reduce the size
> > > > > of the key from 644 to 196 bytes, reducing the cost of both the
> > > > > hashing and equality tests.
> > > > > ---
> > > > >  src/mesa/main/texenvprogram.c |    7 ++++---
> > > > >  1 files changed, 4 insertions(+), 3 deletions(-)
> > > > > 
> > > > > diff --git a/src/mesa/main/texenvprogram.c 
> > > > > b/src/mesa/main/texenvprogra
> > m.c
> > > > > index 5913957..3851937 100644
> > > > > --- a/src/mesa/main/texenvprogram.c
> > > > > +++ b/src/mesa/main/texenvprogram.c
> > > > > @@ -82,8 +82,8 @@ texenv_doing_secondary_color(GLcontext *ctx)
> > > > >  #define DISASSEM (MESA_VERBOSE & VERBOSE_DISASSEM)
> > > > >  
> > > > >  struct mode_opt {
> > > > > -   GLuint Source:4;  /**< SRC_x */
> > > > > -   GLuint Operand:3; /**< OPR_x */
> > > > > +   GLubyte Source:4;  /**< SRC_x */
> > > > > +   GLubyte Operand:3; /**< OPR_x */
> > > > >  };
> > > > 
> > > > This doesn't compact anything. This chunk stay as is.
> > > 
> > > The size of the struct decreases from 4 bytes to one.
> [snip -- simplified example]
> > Interesting. Gcc is trying to do something smart with alignment.
> 
> In that case, wouldn't adding
> 
>   __attribute__((__packed__))
> 
> to the struct def have the same effect (and not rely on a side effect
> of how gcc's alignment algorithm works)?
> 
> I'm not sure of the MSVC equivalent, but I imagine an equivalent
> exists.
> 
> -tom

http://codepad.org/fPf2GDtJ
Yep, that would do it. The MSVC equivalent I believe is:
#pragma pack
This is not understood by GCC though.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to