aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/ADT
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-04-01 18:45:54 +0000
committerDan Gohman <gohman@apple.com>2009-04-01 18:45:54 +0000
commitde551f91d8816632a76a065084caab9fab6aacff (patch)
treefaf864647d57a6d0f3e6e16f199b0559be489e5f /include/llvm/ADT
parentef66abeaeef425927821ddc331d5c14138efe258 (diff)
downloadexternal_llvm-de551f91d8816632a76a065084caab9fab6aacff.zip
external_llvm-de551f91d8816632a76a065084caab9fab6aacff.tar.gz
external_llvm-de551f91d8816632a76a065084caab9fab6aacff.tar.bz2
Use CHAR_BIT instead of hard-coding 8 in several places where it
is appropriate. This helps visually differentiate host-oriented calculations from target-oriented calculations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68227 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT')
-rw-r--r--include/llvm/ADT/APInt.h4
-rw-r--r--include/llvm/ADT/BitVector.h3
-rw-r--r--include/llvm/ADT/SparseBitVector.h3
3 files changed, 7 insertions, 3 deletions
diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h
index a309d7f..388316d 100644
--- a/include/llvm/ADT/APInt.h
+++ b/include/llvm/ADT/APInt.h
@@ -18,6 +18,7 @@
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/MathExtras.h"
#include <cassert>
+#include <climits>
#include <cstring>
#include <string>
@@ -81,7 +82,8 @@ class APInt {
/// This enum is used to hold the constants we needed for APInt.
enum {
/// Bits in a word
- APINT_BITS_PER_WORD = static_cast<unsigned int>(sizeof(uint64_t)) * 8,
+ APINT_BITS_PER_WORD = static_cast<unsigned int>(sizeof(uint64_t)) *
+ CHAR_BIT,
/// Byte size of a word
APINT_WORD_SIZE = static_cast<unsigned int>(sizeof(uint64_t))
};
diff --git a/include/llvm/ADT/BitVector.h b/include/llvm/ADT/BitVector.h
index 23fde26..9c046ef 100644
--- a/include/llvm/ADT/BitVector.h
+++ b/include/llvm/ADT/BitVector.h
@@ -17,6 +17,7 @@
#include "llvm/Support/MathExtras.h"
#include <algorithm>
#include <cassert>
+#include <climits>
#include <cstring>
namespace llvm {
@@ -24,7 +25,7 @@ namespace llvm {
class BitVector {
typedef unsigned long BitWord;
- enum { BITWORD_SIZE = (unsigned)sizeof(BitWord) * 8 };
+ enum { BITWORD_SIZE = (unsigned)sizeof(BitWord) * CHAR_BIT };
BitWord *Bits; // Actual bits.
unsigned Size; // Size of bitvector in bits.
diff --git a/include/llvm/ADT/SparseBitVector.h b/include/llvm/ADT/SparseBitVector.h
index dabcb02..70cb7f4 100644
--- a/include/llvm/ADT/SparseBitVector.h
+++ b/include/llvm/ADT/SparseBitVector.h
@@ -16,6 +16,7 @@
#define LLVM_ADT_SPARSEBITVECTOR_H
#include <cassert>
+#include <climits>
#include <cstring>
#include "llvm/Support/DataTypes.h"
#include "llvm/ADT/STLExtras.h"
@@ -44,7 +45,7 @@ struct SparseBitVectorElement
public:
typedef unsigned long BitWord;
enum {
- BITWORD_SIZE = sizeof(BitWord) * 8,
+ BITWORD_SIZE = sizeof(BitWord) * CHAR_BIT,
BITWORDS_PER_ELEMENT = (ElementSize + BITWORD_SIZE - 1) / BITWORD_SIZE,
BITS_PER_ELEMENT = ElementSize
};