Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Nov 2000 03:11:31 -0800
From:      Julian Elischer <julian@elischer.org>
To:        Ruslan Ermilov <ru@FreeBSD.ORG>
Cc:        Charles Mott <cmott@scientech.com>, Archie Cobbs <archie@dellroad.org>, net@FreeBSD.ORG, Ari Suutari <ari@suutari.iki.fi>
Subject:   Re: libalias: Incremental Update of Internet Checksum
Message-ID:  <3A126F63.8EB0D49@elischer.org>
References:  <Pine.BSF.4.21.0011122254240.50684-100000@carcassonne.scientech.com> <Pine.BSF.4.21.0011130015100.50906-100000@carcassonne.scientech.com> <20001113103852.E34671@sunbay.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Ruslan Ermilov wrote:
> 
Here's the version I wrote some years ago..
  #define FIXSUM16(c, op, np)                                          
\
    do {                                                               
\
      (c) -= (u_int16_t) ~*((u_int16_t *) (op));                       
\
      if ((c) < 0) {                                                   
\
        (c) += 0xffff;                                                 
\
      }                                                                
\
      (c) -= (u_int16_t)  *((u_int16_t *) (np));                       
\
      if ((c) < 0) {                                                   
\
        (c) += 0xffff;                                                 
\
      }                                                                
\
    } while (0)


it replaces the 16 bit word at *op with the new value at *np and updates
the
checksum c


-- 
      __--_|\  Julian Elischer
     /       \ julian@elischer.org
    (   OZ    ) World tour 2000
---> X_.---._/  presently in:  Budapest
            v


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A126F63.8EB0D49>