1 /***********************************************************************
3 * This software is part of the ast package *
4 * Copyright (c) 1996-2010 AT&T Intellectual Property *
5 * and is licensed under the *
6 * Common Public License, Version 1.0 *
7 * by AT&T Intellectual Property *
9 * A copy of the License is available at *
10 * http://www.opensource.org/licenses/cpl1.0.txt *
11 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
13 * Information and Software Systems Research *
17 * Glenn Fowler <gsf@research.att.com> *
19 ***********************************************************************/
26 #define bsd_description \
29 #define bsd_match "bsd|ucb"
30 #define bsd_open long_open
31 #define bsd_init long_init
32 #define bsd_done short_done
33 #define bsd_print long_print
34 #define bsd_data long_data
35 #define bsd_scale 1024
38 bsd_block(register Sum_t
* p
, const void* s
, size_t n
)
40 register uint32_t c
= ((Integral_t
*)p
)->sum
;
41 register unsigned char* b
= (unsigned char*)s
;
42 register unsigned char* e
= b
+ n
;
45 c
= ((c
>> 1) + *b
++ + ((c
& 01) ? 0x8000 : 0)) & 0xffff;
46 ((Integral_t
*)p
)->sum
= c
;