in_cksum.c (128019) | in_cksum.c (143063) |
---|---|
1/*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * from tahoe: in_cksum.c 1.2 86/01/05 30 * from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91 31 */ 32 33#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * from tahoe: in_cksum.c 1.2 86/01/05 30 * from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91 31 */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/i386/i386/in_cksum.c 128019 2004-04-07 20:46:16Z imp $"); | 34__FBSDID("$FreeBSD: head/sys/i386/i386/in_cksum.c 143063 2005-03-02 21:33:29Z joerg $"); |
35 36/* 37 * MPsafe: alfred 38 */ 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/mbuf.h> 42 --- 9 unchanged lines hidden (view full) --- 52 * This routine is very heavily used in the network 53 * code and should be modified for each CPU to be as fast as possible. 54 * 55 * This implementation is 386 version. 56 */ 57 58#undef ADDCARRY 59#define ADDCARRY(x) if ((x) > 0xffff) (x) -= 0xffff | 35 36/* 37 * MPsafe: alfred 38 */ 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/mbuf.h> 42 --- 9 unchanged lines hidden (view full) --- 52 * This routine is very heavily used in the network 53 * code and should be modified for each CPU to be as fast as possible. 54 * 55 * This implementation is 386 version. 56 */ 57 58#undef ADDCARRY 59#define ADDCARRY(x) if ((x) > 0xffff) (x) -= 0xffff |
60#if !defined(__GNUC__) || defined(__INTEL_COMPILER) | 60/* 61 * icc needs to be special cased here, as the asm code below results 62 * in broken code if compiled with icc. 63 */ 64#if !defined(__GNUCLIKE_ASM) || defined(__INTEL_COMPILER) |
61/* non gcc parts stolen from sys/alpha/alpha/in_cksum.c */ 62#define REDUCE32 \ 63 { \ 64 q_util.q = sum; \ 65 sum = q_util.s[0] + q_util.s[1] + q_util.s[2] + q_util.s[3]; \ 66 } 67#define REDUCE16 \ 68 { \ 69 q_util.q = sum; \ 70 l_util.l = q_util.s[0] + q_util.s[1] + q_util.s[2] + q_util.s[3]; \ 71 sum = l_util.s[0] + l_util.s[1]; \ 72 ADDCARRY(sum); \ 73 } 74#endif 75#define REDUCE {sum = (sum & 0xffff) + (sum >> 16); ADDCARRY(sum);} 76 | 65/* non gcc parts stolen from sys/alpha/alpha/in_cksum.c */ 66#define REDUCE32 \ 67 { \ 68 q_util.q = sum; \ 69 sum = q_util.s[0] + q_util.s[1] + q_util.s[2] + q_util.s[3]; \ 70 } 71#define REDUCE16 \ 72 { \ 73 q_util.q = sum; \ 74 l_util.l = q_util.s[0] + q_util.s[1] + q_util.s[2] + q_util.s[3]; \ 75 sum = l_util.s[0] + l_util.s[1]; \ 76 ADDCARRY(sum); \ 77 } 78#endif 79#define REDUCE {sum = (sum & 0xffff) + (sum >> 16); ADDCARRY(sum);} 80 |
77#if !defined(__GNUC__) || defined(__INTEL_COMPILER) | 81#if !defined(__GNUCLIKE_ASM) || defined(__INTEL_COMPILER) |
78static const u_int32_t in_masks[] = { 79 /*0 bytes*/ /*1 byte*/ /*2 bytes*/ /*3 bytes*/ 80 0x00000000, 0x000000FF, 0x0000FFFF, 0x00FFFFFF, /* offset 0 */ 81 0x00000000, 0x0000FF00, 0x00FFFF00, 0xFFFFFF00, /* offset 1 */ 82 0x00000000, 0x00FF0000, 0xFFFF0000, 0xFFFF0000, /* offset 2 */ 83 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, /* offset 3 */ 84}; 85 --- 371 unchanged lines hidden --- | 82static const u_int32_t in_masks[] = { 83 /*0 bytes*/ /*1 byte*/ /*2 bytes*/ /*3 bytes*/ 84 0x00000000, 0x000000FF, 0x0000FFFF, 0x00FFFFFF, /* offset 0 */ 85 0x00000000, 0x0000FF00, 0x00FFFF00, 0xFFFFFF00, /* offset 1 */ 86 0x00000000, 0x00FF0000, 0xFFFF0000, 0xFFFF0000, /* offset 2 */ 87 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, /* offset 3 */ 88}; 89 --- 371 unchanged lines hidden --- |