Print this page
4374 dn_free_ranges should use range_tree_t
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Max Grossman <max.grossman@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Dan McDonald <danmcd@omniti.com>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/sparc/os/bitmap_arch.c
+++ new/usr/src/uts/sparc/os/bitmap_arch.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
↓ open down ↓ |
15 lines elided |
↑ open up ↑ |
16 16 * If applicable, add the following below this CDDL HEADER, with the
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /*
23 23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 -#pragma ident "%Z%%M% %I% %E% SMI"
27 26
28 27 /*
28 + * Copyright (c) 2014 by Delphix. All rights reserved.
29 + */
30 +
31 +/*
29 32 * Architecture specific definition for bitmap related routines.
30 33 * These may be implemented using ISA specific instructions.
31 34 */
32 35 #include <sys/bitmap.h>
33 36
34 37 /*
38 + * Find highest one bit set.
39 + * Returns bit number + 1 of highest bit that is set, otherwise returns 0.
40 + */
41 +int
42 +highbit64(uint64_t i)
43 +{
44 + int h = 1;
45 +
46 + if (i == 0)
47 + return (0);
48 + if (i & 0xffffffff00000000ULL) {
49 + h += 32; i >>= 32;
50 + }
51 + if (i & 0xffff0000) {
52 + h += 16; i >>= 16;
53 + }
54 + if (i & 0xff00) {
55 + h += 8; i >>= 8;
56 + }
57 + if (i & 0xf0) {
58 + h += 4; i >>= 4;
59 + }
60 + if (i & 0xc) {
61 + h += 2; i >>= 2;
62 + }
63 + if (i & 0x2) {
64 + h += 1;
65 + }
66 + return (h);
67 +}
68 +
69 +/*
35 70 * Find highest one bit set.
36 71 * Returns bit number + 1 of highest bit that is set, otherwise returns 0.
37 72 * High order bit is 31 (or 63 in _LP64 kernel).
38 73 */
39 74 int
40 75 highbit(ulong_t i)
41 76 {
42 77 register int h = 1;
43 78
44 79 if (i == 0)
45 80 return (0);
46 81 #ifdef _LP64
47 82 if (i & 0xffffffff00000000ul) {
48 83 h += 32; i >>= 32;
49 84 }
50 85 #endif
51 86 if (i & 0xffff0000) {
52 87 h += 16; i >>= 16;
53 88 }
54 89 if (i & 0xff00) {
55 90 h += 8; i >>= 8;
56 91 }
57 92 if (i & 0xf0) {
58 93 h += 4; i >>= 4;
59 94 }
60 95 if (i & 0xc) {
61 96 h += 2; i >>= 2;
62 97 }
63 98 if (i & 0x2) {
64 99 h += 1;
65 100 }
66 101 return (h);
67 102 }
68 103
69 104 /*
70 105 * Find lowest one bit set.
71 106 * Returns bit number + 1 of lowest bit that is set, otherwise returns 0.
72 107 * Low order bit is 0.
73 108 */
74 109 int
75 110 lowbit(ulong_t i)
76 111 {
77 112 register int h = 1;
78 113
79 114 if (i == 0)
80 115 return (0);
81 116
82 117 #ifdef _LP64
83 118 if (!(i & 0xffffffff)) {
84 119 h += 32; i >>= 32;
85 120 }
86 121 #endif
87 122 if (!(i & 0xffff)) {
88 123 h += 16; i >>= 16;
89 124 }
90 125 if (!(i & 0xff)) {
91 126 h += 8; i >>= 8;
92 127 }
93 128 if (!(i & 0xf)) {
94 129 h += 4; i >>= 4;
95 130 }
96 131 if (!(i & 0x3)) {
97 132 h += 2; i >>= 2;
98 133 }
99 134 if (!(i & 0x1)) {
100 135 h += 1;
101 136 }
102 137 return (h);
103 138 }
|
↓ open down ↓ |
59 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX