|
||||
Warning, cross-references for /kernel/include/util/crc32.h need to be fixed.
0001 /* The Quest Operating System 0002 * Copyright (C) 2005-2010 Richard West, Boston University 0003 * 0004 * This program is free software: you can redistribute it and/or modify 0005 * it under the terms of the GNU General Public License as published by 0006 * the Free Software Foundation, either version 3 of the License, or 0007 * (at your option) any later version. 0008 * 0009 * This program is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0012 * GNU General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU General Public License 0015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0016 */ 0017 0018 /* Adopted from Linux */ 0019 0020 #ifndef _UTIL_CRC32_H_ 0021 #define _UTIL_CRC32_H_ 0022 0023 #include <types.h> 0024 0025 extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len); 0026 extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len); 0027 0028 #define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)data, length) 0029 0030 /* 0031 * Helpers for hash table generation of ethernet nics: 0032 * 0033 * Ethernet sends the least significant bit of a byte first, thus crc32_le 0034 * is used. The output of crc32_le is bit reversed [most significant bit 0035 * is in bit nr 0], thus it must be reversed before use. Except for 0036 * nics that bit swap the result internally... 0037 */ 0038 #define ether_crc(length, data) bitrev32(crc32_le(~0, data, length)) 0039 #define ether_crc_le(length, data) crc32_le(~0, data, length) 0040 0041 0042 #endif 0043 0044 /* 0045 * Local Variables: 0046 * indent-tabs-mode: nil 0047 * mode: C 0048 * c-file-style: "gnu" 0049 * c-basic-offset: 2 0050 * End: 0051 */ 0052 0053 /* vi: set et sw=2 sts=2: */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 1.2.0 LXR engine. |