about summary refs log tree commit diff
path: root/src/librustc_data_structures
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2018-07-13 10:53:57 +1000
committerNicholas Nethercote <nnethercote@mozilla.com>2018-07-13 11:10:20 +1000
commitf0c67951d076db8272f7a52f4d2596ae77b3311d (patch)
tree056927fe4e9c12ee15c4f2f564ef6a83f52e2f03 /src/librustc_data_structures
parent05742ffb432adb0278bcb7262251cec9657d4067 (diff)
downloadrust-f0c67951d076db8272f7a52f4d2596ae77b3311d.tar.gz
rust-f0c67951d076db8272f7a52f4d2596ae77b3311d.zip
Make BitSlice's `Word` properly generic.
Currently `Word` is `usize`, and there are various places in the code
that assume this.

This patch mostly just changes `usize` occurrences to `Word`. Most of
the changes were found as compile errors when I changed `Word` to a type
other than `usize`, but there was one non-obvious case in
librustc_mir/dataflow/mod.rs that caused bounds check failures before I
fixed it.
Diffstat (limited to 'src/librustc_data_structures')
-rw-r--r--src/librustc_data_structures/bitslice.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/librustc_data_structures/bitslice.rs b/src/librustc_data_structures/bitslice.rs
index 2678861be06..5b5dd907cb7 100644
--- a/src/librustc_data_structures/bitslice.rs
+++ b/src/librustc_data_structures/bitslice.rs
@@ -79,7 +79,7 @@ fn bit_lookup(bit: usize) -> BitLookup {
 }
 
 
-fn bit_str(bit: Word) -> String {
+fn bit_str(bit: usize) -> String {
     let byte = bit >> 3;
     let lobits = 1 << (bit & 0b111);
     format!("[{}:{}-{:02x}]", bit, byte, lobits)
@@ -116,8 +116,8 @@ pub fn bits_to_string(words: &[Word], bits: usize) -> String {
 }
 
 #[inline]
-pub fn bitwise<Op:BitwiseOperator>(out_vec: &mut [usize],
-                                   in_vec: &[usize],
+pub fn bitwise<Op:BitwiseOperator>(out_vec: &mut [Word],
+                                   in_vec: &[Word],
                                    op: &Op) -> bool {
     assert_eq!(out_vec.len(), in_vec.len());
     let mut changed = false;
@@ -132,21 +132,21 @@ pub fn bitwise<Op:BitwiseOperator>(out_vec: &mut [usize],
 
 pub trait BitwiseOperator {
     /// Applies some bit-operation pointwise to each of the bits in the two inputs.
-    fn join(&self, pred1: usize, pred2: usize) -> usize;
+    fn join(&self, pred1: Word, pred2: Word) -> Word;
 }
 
 pub struct Intersect;
 impl BitwiseOperator for Intersect {
     #[inline]
-    fn join(&self, a: usize, b: usize) -> usize { a & b }
+    fn join(&self, a: Word, b: Word) -> Word { a & b }
 }
 pub struct Union;
 impl BitwiseOperator for Union {
     #[inline]
-    fn join(&self, a: usize, b: usize) -> usize { a | b }
+    fn join(&self, a: Word, b: Word) -> Word { a | b }
 }
 pub struct Subtract;
 impl BitwiseOperator for Subtract {
     #[inline]
-    fn join(&self, a: usize, b: usize) -> usize { a & !b }
+    fn join(&self, a: Word, b: Word) -> Word { a & !b }
 }