'long' will be 32b on Windows, even on x64 targets. For this reason,
we can't use "long" when casting a pointer.
We'll use uintptr_t instead.
Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
raw_hack_aligned(unsigned l, unsigned _align) : raw(l) {
align = _align;
realdata = new char[len+align-1];
- unsigned off = ((unsigned)realdata) & (align-1);
+ unsigned off = ((uintptr_t)realdata) & (align-1);
if (off)
data = realdata + align - off;
else
//cout << "hack aligned " << (unsigned)data
//<< " in raw " << (unsigned)realdata
//<< " off " << off << std::endl;
- ceph_assert(((unsigned)data & (align-1)) == 0);
+ ceph_assert(((uintptr_t)data & (align-1)) == 0);
}
~raw_hack_aligned() {
delete[] realdata;
// misc
bool is_aligned(unsigned align) const {
- return ((long)c_str() & (align-1)) == 0;
+ return ((uintptr_t)c_str() & (align-1)) == 0;
}
bool is_page_aligned() const { return is_aligned(CEPH_PAGE_SIZE); }
bool is_n_align_sized(unsigned align) const
#define IS_ERR_VALUE(x) ((x) >= (unsigned long)-MAX_ERRNO)
#include <errno.h>
+#include <stdint.h>
/* this generates a warning in c++; caller can do the cast manually
static inline void *ERR_PTR(long error)
static inline long PTR_ERR(const void *ptr)
{
- return (long) ptr;
+ return (uintptr_t) ptr;
}
static inline long IS_ERR(const void *ptr)
{
- return IS_ERR_VALUE((unsigned long)ptr);
+ return IS_ERR_VALUE((uintptr_t)ptr);
}
#endif