Sun Mar 21 14:28:15 2010 UTC ()
revert previous for now.


(christos)
diff -r1.6 -r1.7 src/sys/sys/bitops.h

cvs diff -r1.6 -r1.7 src/sys/sys/bitops.h (expand / switch to unified diff)

--- src/sys/sys/bitops.h 2010/03/21 00:04:34 1.6
+++ src/sys/sys/bitops.h 2010/03/21 14:28:15 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bitops.h,v 1.6 2010/03/21 00:04:34 christos Exp $ */ 1/* $NetBSD: bitops.h,v 1.7 2010/03/21 14:28:15 christos Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007, 2010 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007, 2010 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Christos Zoulas and Joerg Sonnenberger. 8 * by Christos Zoulas and Joerg Sonnenberger.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -269,26 +269,26 @@ fast_divide32_prepare(uint32_t _div, uin @@ -269,26 +269,26 @@ fast_divide32_prepare(uint32_t _div, uin
269 _mt = 0x100000000ULL * ((1ULL << _l) - _div); 269 _mt = 0x100000000ULL * ((1ULL << _l) - _div);
270 *_m = (uint32_t)(_mt / _div + 1); 270 *_m = (uint32_t)(_mt / _div + 1);
271 *_s1 = (_l > 1) ? 1 : _l; 271 *_s1 = (_l > 1) ? 1 : _l;
272 *_s2 = (_l == 0) ? 0 : _l - 1; 272 *_s2 = (_l == 0) ? 0 : _l - 1;
273} 273}
274 274
275/* ARGSUSED */ 275/* ARGSUSED */
276static __inline uint32_t 276static __inline uint32_t
277fast_divide32(uint32_t _v, uint32_t _div, uint32_t _m, uint8_t _s1, 277fast_divide32(uint32_t _v, uint32_t _div, uint32_t _m, uint8_t _s1,
278 uint8_t _s2) 278 uint8_t _s2)
279{ 279{
280 uint32_t _t; 280 uint32_t _t;
281 281
282 _t = ((uint64_t)_v * _m) >> 32; 282 _t = (uint32_t)(((uint64_t)_v * _m) >> 32);
283 return (_t + ((_v - _t) >> _s1)) >> _s2; 283 return (_t + ((_v - _t) >> _s1)) >> _s2;
284} 284}
285 285
286static __inline uint32_t 286static __inline uint32_t
287fast_remainder32(uint32_t _v, uint32_t _div, uint32_t _m, uint8_t _s1, 287fast_remainder32(uint32_t _v, uint32_t _div, uint32_t _m, uint8_t _s1,
288 uint8_t _s2) 288 uint8_t _s2)
289{ 289{
290 290
291 return _v - _div * fast_divide32(_v, _div, _m, _s1, _s2); 291 return _v - _div * fast_divide32(_v, _div, _m, _s1, _s2);
292} 292}
293 293
294#endif /* _SYS_BITOPS_H_ */ 294#endif /* _SYS_BITOPS_H_ */