File tree Expand file tree Collapse file tree 1 file changed +3
-13
lines changed
compiler/rustc_data_structures/src Expand file tree Collapse file tree 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 {
155155 while let & [ tag, ref rest @ ..] = tags {
156156 tags = rest;
157157
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 ( ) ;
159161 if b > bits {
160162 bits = b;
161163 }
@@ -164,18 +166,6 @@ pub const fn bits_for_tags(mut tags: &[usize]) -> u32 {
164166 bits
165167}
166168
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-
179169unsafe impl < T : ?Sized + Aligned > Pointer for Box < T > {
180170 const BITS : u32 = bits_for :: < Self :: Target > ( ) ;
181171
You can’t perform that action at this time.
0 commit comments