File tree Expand file tree Collapse file tree 3 files changed +5
-28
lines changed Expand file tree Collapse file tree 3 files changed +5
-28
lines changed Original file line number Diff line number Diff line change 1
1
//! A unique table based on a bump allocator and robin-hood hashing
2
2
//! this is the primary unique table for storing all nodes
3
3
4
- use crate :: { backing_store:: UniqueTable , util :: * } ;
4
+ use crate :: backing_store:: UniqueTable ;
5
5
use bumpalo:: Bump ;
6
6
use rustc_hash:: FxHasher ;
7
7
use std:: {
@@ -105,7 +105,7 @@ where
105
105
{
106
106
/// reserve a robin-hood table capable of holding at least `sz` elements
107
107
pub fn new ( ) -> BackedRobinhoodTable < ' a , T > {
108
- let v: Vec < HashTableElement < T > > = zero_vec ( DEFAULT_SIZE ) ;
108
+ let v: Vec < HashTableElement < T > > = vec ! [ HashTableElement :: default ( ) ; DEFAULT_SIZE ] ;
109
109
110
110
BackedRobinhoodTable {
111
111
tbl : v,
@@ -135,7 +135,7 @@ where
135
135
pub fn grow ( & mut self ) {
136
136
let new_sz = ( self . cap + 1 ) . next_power_of_two ( ) ;
137
137
self . cap = new_sz;
138
- let old = mem:: replace ( & mut self . tbl , zero_vec ( new_sz ) ) ;
138
+ let old = mem:: replace ( & mut self . tbl , vec ! [ HashTableElement :: default ( ) ; new_sz ] ) ;
139
139
let c = self . cap ;
140
140
for i in old. iter ( ) {
141
141
propagate ( & mut self . tbl , self . cap , i. clone ( ) , ( i. hash as usize ) % c) ;
Original file line number Diff line number Diff line change 2
2
//! in the order occur first in the BDD, starting from the root.
3
3
//! Lower numbers occur first in the order (i.e., closer to the root)
4
4
5
- use crate :: { repr:: var_label:: VarLabel , util } ;
5
+ use crate :: repr:: var_label:: VarLabel ;
6
6
use std:: fmt:: { Debug , Display } ;
7
7
8
8
#[ derive( Debug , Clone ) ]
@@ -19,7 +19,7 @@ impl VarOrder {
19
19
/// Creates a new variable order (elements that occur first in the vector
20
20
/// occur first in the order)
21
21
pub fn new ( order : Vec < VarLabel > ) -> VarOrder {
22
- let mut v = util :: malloc_vec ( order. len ( ) ) ;
22
+ let mut v = vec ! [ 0 ; order. len( ) ] ;
23
23
let mut pos_to_var = Vec :: new ( ) ;
24
24
for i in 0 ..order. len ( ) {
25
25
v[ order[ i] . value ( ) as usize ] = i;
Original file line number Diff line number Diff line change @@ -5,8 +5,6 @@ pub mod hypergraph;
5
5
pub mod lru;
6
6
pub mod semirings;
7
7
8
- use std:: ptr;
9
-
10
8
/// A generic bit-field which makes it easier to get and set
11
9
/// bit-level fields
12
10
#[ macro_export]
@@ -30,24 +28,3 @@ macro_rules! BITFIELD {
30
28
) +}
31
29
}
32
30
}
33
-
34
- /// custom allocations for zeroed vectors
35
- pub fn zero_vec < T > ( sz : usize ) -> Vec < T > {
36
- let mut v: Vec < T > = Vec :: with_capacity ( sz) ;
37
- unsafe {
38
- let vec_ptr = v. as_mut_ptr ( ) ;
39
- ptr:: write_bytes ( vec_ptr, 0 , sz) ;
40
- v. set_len ( sz) ;
41
- }
42
- v
43
- }
44
-
45
- /// custom allocation of a non-initialized vector
46
- #[ allow( clippy:: uninit_vec) ] // intentional!
47
- pub fn malloc_vec < T > ( sz : usize ) -> Vec < T > {
48
- let mut v: Vec < T > = Vec :: with_capacity ( sz) ;
49
- unsafe {
50
- v. set_len ( sz) ;
51
- }
52
- v
53
- }
You can’t perform that action at this time.
0 commit comments