Use uptr (std::uintptr_t alias)

This commit is contained in:
Nekotekina 2020-12-12 16:29:55 +03:00
parent b59f142d4e
commit a6a5292cd7
15 changed files with 62 additions and 62 deletions

View file

@ -343,7 +343,7 @@ struct MemoryManager1 : llvm::RTDyldMemoryManager
return {addr, llvm::JITSymbolFlags::Exported};
}
u8* allocate(u64& oldp, std::uintptr_t size, uint align, utils::protection prot)
u8* allocate(u64& oldp, uptr size, uint align, utils::protection prot)
{
if (align > c_page_size)
{
@ -374,12 +374,12 @@ struct MemoryManager1 : llvm::RTDyldMemoryManager
return this->ptr + olda;
}
u8* allocateCodeSection(std::uintptr_t size, uint align, uint sec_id, llvm::StringRef sec_name) override
u8* allocateCodeSection(uptr size, uint align, uint sec_id, llvm::StringRef sec_name) override
{
return allocate(code_ptr, size, align, utils::protection::wx);
}
u8* allocateDataSection(std::uintptr_t size, uint align, uint sec_id, llvm::StringRef sec_name, bool is_ro) override
u8* allocateDataSection(uptr size, uint align, uint sec_id, llvm::StringRef sec_name, bool is_ro) override
{
return allocate(data_ptr, size, align, utils::protection::rw);
}
@ -407,12 +407,12 @@ struct MemoryManager2 : llvm::RTDyldMemoryManager
{
}
u8* allocateCodeSection(std::uintptr_t size, uint align, uint sec_id, llvm::StringRef sec_name) override
u8* allocateCodeSection(uptr size, uint align, uint sec_id, llvm::StringRef sec_name) override
{
return jit_runtime::alloc(size, align, true);
}
u8* allocateDataSection(std::uintptr_t size, uint align, uint sec_id, llvm::StringRef sec_name, bool is_ro) override
u8* allocateDataSection(uptr size, uint align, uint sec_id, llvm::StringRef sec_name, bool is_ro) override
{
return jit_runtime::alloc(size, align, false);
}

View file

@ -19,7 +19,7 @@ struct fmt_unveil
static inline u64 get(const T& arg)
{
return reinterpret_cast<std::uintptr_t>(&arg);
return reinterpret_cast<uptr>(&arg);
}
// Temporary value container (can possibly be created by other fmt_unveil<> specializations)
@ -30,7 +30,7 @@ struct fmt_unveil
// Allow implicit conversion
operator u64() const
{
return reinterpret_cast<std::uintptr_t>(&arg);
return reinterpret_cast<uptr>(&arg);
}
};
@ -93,7 +93,7 @@ struct fmt_unveil<T*, void>
static inline u64 get(type arg)
{
return reinterpret_cast<std::uintptr_t>(arg);
return reinterpret_cast<uptr>(arg);
}
};
@ -104,7 +104,7 @@ struct fmt_unveil<T[N], void>
static inline u64 get(type arg)
{
return reinterpret_cast<std::uintptr_t>(arg);
return reinterpret_cast<uptr>(arg);
}
};
@ -132,7 +132,7 @@ struct fmt_class_string
// Helper function (converts arg to object reference)
static SAFE_BUFFERS FORCE_INLINE const T& get_object(u64 arg)
{
return *reinterpret_cast<const T*>(static_cast<std::uintptr_t>(arg));
return *reinterpret_cast<const T*>(static_cast<uptr>(arg));
}
// Enum -> string function type

View file

@ -2459,8 +2459,8 @@ void thread_ctrl::detect_cpu_layout()
else
{
// Iterate through the buffer until a core with hyperthreading is found
auto ptr = reinterpret_cast<std::uintptr_t>(buffer.data());
const std::uintptr_t end = ptr + buffer_size;
auto ptr = reinterpret_cast<uptr>(buffer.data());
const uptr end = ptr + buffer_size;
while (ptr < end)
{

View file

@ -586,7 +586,7 @@ namespace utils
const uint align = type->align;
const uint ssize = ::align<uint>(sizeof(typemap_block), align) + ::align(type->size, align);
const auto total = std::size_t{ssize} * type->count;
const auto start = std::uintptr_t{::align(m_total, align)};
const auto start = uptr{::align(m_total, align)};
if (total)
{
@ -612,7 +612,7 @@ namespace utils
{
if (m_map[i].m_count)
{
m_map[i].m_ptr = static_cast<uchar*>(m_memory) + reinterpret_cast<std::uintptr_t>(m_map[i].m_ptr);
m_map[i].m_ptr = static_cast<uchar*>(m_memory) + reinterpret_cast<uptr>(m_map[i].m_ptr);
}
}
}