Permalink
Browse files

Some type casts to avoid warnings.

  • Loading branch information...
emeryberger committed Jul 18, 2015
1 parent ac05111 commit 5c33e3783b2852c2127bf5ec5d76980e24916d89
Showing with 13 additions and 38 deletions.
  1. +1 −1 heaps/debug/logheap.h
  2. +2 −27 heaps/general/dlheap.h
  3. +1 −1 heaps/top/mmapheap.h
  4. +1 −1 threads/cpuinfo.h
  5. +6 −6 utility/ilog2.h
  6. +2 −2 wrappers/mmapwrapper.h
View
@@ -194,7 +194,7 @@ namespace HL {
// Set sec & usec to the current time.
void markTime (long& sec, long& usec)
void markTime (long& /* sec */, long& /* usec */)
{
#if 0
#ifdef __SVR4 // Solaris
View
@@ -307,37 +307,12 @@ namespace DLBigHeapNS
if (sz1 <= 513) {
return (int) (sz1 >> 3);
} else {
#if 0
// size_t sz1 = sz - 1;
sz1 >>= 6;
if (sz1 <= 32) {
return 56 + sz1;
}
sz1 >>= 3;
if (sz1 <= 20) {
return 91 + sz1;
}
sz1 >>= 3;
if (sz1 <= 10) {
return 110 - 6 + sz1;
}
sz1 >>= 3;
if (sz1 <= 4) {
return 119 - 6 + sz1;
}
sz1 >>= 3;
if (sz1 <= 2) {
return 124 - 6 + sz1;
}
return 125 - 6 + log2(sz1 >> 2);
#else
const size_t sz1 = sz - 1;
return (int) ((((sz1 >> 6) <= 32)? 56 + (sz1 >> 6):
((sz1 >> 9) <= 20)? 91 + (sz1 >> 9):
((sz1 >> 12) <= 10)? 110 - 6 + (sz1 >> 12):
((sz1 >> 15) <= 4)? 119 - 6 + (sz1 >> 15):
((sz1 >> 18) <= 2)? 124 - 6 + (sz1 >> 18): 126 - 6 + log2(sz1>>19)));
#endif
((sz1 >> 18) <= 2)? 124 - 6 + (sz1 >> 18):
126 - 6 + (size_t) log2(sz1>>19)));
}
}
View
@@ -114,7 +114,7 @@ namespace HL {
static inline void * malloc (size_t sz) {
// Round up to the size of a page.
sz = (sz + CPUInfo::PageSize - 1) & ~(CPUInfo::PageSize - 1);
sz = (sz + CPUInfo::PageSize - 1) & (size_t) ~(CPUInfo::PageSize - 1);
#if defined(MAP_ALIGN) && defined(MAP_ANON)
// Request memory aligned to the Alignment value above.
void * ptr = mmap ((char *) Alignment, sz, HL_MMAP_PROTECTION_MASK, MAP_PRIVATE | MAP_ALIGN | MAP_ANON, -1, 0);
View
@@ -93,7 +93,7 @@ class CPUInfo {
public:
// Good for practically all platforms.
enum { PageSize = 4096 };
enum { PageSize = 4096UL };
inline static int getNumProcessors() {
static int _numProcessors = computeNumProcessors();
View
@@ -11,7 +11,7 @@ namespace HL {
/// Quickly calculate the CEILING of the log (base 2) of the argument.
#if defined(_WIN32)
static inline int ilog2 (size_t sz)
static inline unsigned int ilog2 (size_t sz)
{
DWORD index;
_BitScanReverse (&index, sz);
@@ -22,20 +22,20 @@ namespace HL {
}
}
#elif defined(__GNUC__) && defined(__i386__)
static inline int ilog2 (size_t sz)
static inline unsigned int ilog2 (size_t sz)
{
sz = (sz << 1) - 1;
asm ("bsrl %0, %0" : "=r" (sz) : "0" (sz));
return (int) sz;
return (unsigned int) sz;
}
#elif defined(__GNUC__)
// Just use the intrinsic.
static inline int ilog2 (const size_t sz)
static inline unsigned int ilog2 (const size_t sz)
{
return (int) ((sizeof(size_t) * 8) - __builtin_clzl((sz << 1) - 1) - 1);
return ((int) (sizeof(size_t) * 8) - (int) __builtin_clzl((sz << 1) - 1) - 1);
}
#else
static inline int ilog2 (size_t v) {
static inline unsigned int ilog2 (size_t v) {
int log = 0;
unsigned int value = 1;
while (value < v) {
View
@@ -143,7 +143,7 @@ namespace HL {
sz = Size * ((sz + Size - 1) / Size);
void * ptr;
unsigned int mapFlag = 0;
int mapFlag = 0;
char * startAddress = 0;
#if defined(MAP_ALIGN) && defined(MAP_ANON)
@@ -158,7 +158,7 @@ namespace HL {
mapFlag |= MAP_ANONYMOUS | MAP_PRIVATE;
#endif
ptr = mmap (startAddress, sz, HL_MMAP_PROTECTION_MASK, mapFlag, fd, 0);
ptr = mmap (startAddress, sz, HL_MMAP_PROTECTION_MASK, mapFlag, fd, 0);
if (ptr == MAP_FAILED) {
return NULL;

0 comments on commit 5c33e37

Please sign in to comment.