File tree 1 file changed +3
-13
lines changed
compiler/rustc_data_structures/src
1 file changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -155,7 +155,9 @@ pub const fn bits_for_tags(mut tags: &[usize]) -> u32 {
155
155
while let & [ tag, ref rest @ ..] = tags {
156
156
tags = rest;
157
157
158
- let b = bits_for_tag ( tag) ;
158
+ // bits required to represent `tag`,
159
+ // position of the most significant 1
160
+ let b = usize:: BITS - tag. leading_zeros ( ) ;
159
161
if b > bits {
160
162
bits = b;
161
163
}
@@ -164,18 +166,6 @@ pub const fn bits_for_tags(mut tags: &[usize]) -> u32 {
164
166
bits
165
167
}
166
168
167
- /// Returns `(size_of::<usize>() * 8) - tag.leading_zeros()`
168
- const fn bits_for_tag ( mut tag : usize ) -> u32 {
169
- let mut bits = 0 ;
170
-
171
- while tag > 0 {
172
- bits += 1 ;
173
- tag >>= 1 ;
174
- }
175
-
176
- bits
177
- }
178
-
179
169
unsafe impl < T : ?Sized + Aligned > Pointer for Box < T > {
180
170
const BITS : u32 = bits_for :: < Self :: Target > ( ) ;
181
171
You can’t perform that action at this time.
0 commit comments