freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Devel] suggested improvement to FT_Add64


From: Graham Asher
Subject: [Devel] suggested improvement to FT_Add64
Date: Thu, 11 Oct 2001 18:40:18 +0100

This might be said to be nitpicking, but there is a small improvement to be
made to FT_Add64, which might save a cycle or two:

replace

  FT_EXPORT_DEF( void )  FT_Add64( FT_Int64*  x,
                                   FT_Int64*  y,
                                   FT_Int64  *z )
  {
    register FT_UInt32  lo, hi;


    lo = x->lo + y->lo;
    hi = x->hi + y->hi + ( lo < x->lo );

    z->lo = lo;
    z->hi = hi;
  }

with

  FT_EXPORT_DEF( void )  FT_Add64( FT_Int64*  x,
                                   FT_Int64*  y,
                                   FT_Int64  *z )
  {
    z->lo = x->lo + y->lo;
    z->hi = x->hi + y->hi + (z->lo < x->lo );
  }

There is no need for the local variables. Anything gained by the use of a
local variable 'lo' instead of 'z->lo', which is used twice, would surely be
lost by the extra assignments to 'lo' and 'z->lo'. And 'register' is
irrelevant to modern compilers.

Graham Asher




reply via email to

[Prev in Thread] Current Thread [Next in Thread]