mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-18 18:20:35 +03:00
Fix C-style casts
This commit is contained in:
@@ -68,6 +68,7 @@ namespace ue2 {
|
||||
#endif
|
||||
|
||||
void *aligned_malloc_internal(size_t size, size_t align) {
|
||||
// cppcheck-suppress cstyleCast
|
||||
void *mem= nullptr;;
|
||||
int rv = posix_memalign(&mem, align, size);
|
||||
if (rv != 0) {
|
||||
@@ -104,17 +105,17 @@ void *aligned_zmalloc(size_t size) {
|
||||
|
||||
const size_t alloc_size = size + HACK_OFFSET;
|
||||
|
||||
void *mem = aligned_malloc_internal(alloc_size, 64);
|
||||
char *mem = static_cast<char *>(aligned_malloc_internal(alloc_size, 64));
|
||||
if (!mem) {
|
||||
DEBUG_PRINTF("unable to allocate %zu bytes\n", alloc_size);
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
|
||||
DEBUG_PRINTF("alloced %p reporting %p\n", mem, (char *)mem + HACK_OFFSET);
|
||||
DEBUG_PRINTF("alloced %p reporting %p\n", mem, mem + HACK_OFFSET);
|
||||
assert(ISALIGNED_N(mem, 64));
|
||||
|
||||
memset(mem, 0, alloc_size);
|
||||
return (void *)((char *)mem + HACK_OFFSET);
|
||||
return reinterpret_cast<void *>(mem + HACK_OFFSET);
|
||||
}
|
||||
|
||||
/** \brief Free a pointer allocated with \ref aligned_zmalloc. */
|
||||
@@ -123,7 +124,7 @@ void aligned_free(void *ptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
void *addr = (void *)((char *)ptr - HACK_OFFSET);
|
||||
ptrdiff_t *addr = static_cast<ptrdiff_t *>(ptr) - HACK_OFFSET;
|
||||
DEBUG_PRINTF("asked to free %p freeing %p\n", ptr, addr);
|
||||
|
||||
assert(ISALIGNED_N(addr, 64));
|
||||
|
||||
@@ -511,7 +511,7 @@ really_inline SuperVector<16> SuperVector<16>::Ones_vshl(uint8_t const N)
|
||||
template <>
|
||||
really_inline SuperVector<16> SuperVector<16>::loadu(void const *ptr)
|
||||
{
|
||||
return {SuperVector<16>(vld1q_s32((const int32_t *)ptr))};
|
||||
return {SuperVector<16>(vld1q_s32(reinterpret_cast<const int32_t *>(ptr)))};
|
||||
}
|
||||
|
||||
template <>
|
||||
@@ -519,7 +519,7 @@ really_inline SuperVector<16> SuperVector<16>::load(void const *ptr)
|
||||
{
|
||||
assert(ISALIGNED_N(ptr, alignof(SuperVector::size)));
|
||||
ptr = vectorscan_assume_aligned(ptr, SuperVector::size);
|
||||
return {SuperVector<16>(vld1q_s32((const int32_t *)ptr))};
|
||||
return {SuperVector<16>(vld1q_s32(reinterpret_cast<const int32_t *>(ptr)))};
|
||||
}
|
||||
|
||||
template <>
|
||||
|
||||
@@ -508,7 +508,7 @@ really_inline SuperVector<16> SuperVector<16>::Ones_vshl(uint8_t const N)
|
||||
template <>
|
||||
really_inline SuperVector<16> SuperVector<16>::loadu(void const *ptr)
|
||||
{
|
||||
return SuperVector<16>(_mm_loadu_si128((const m128 *)ptr));
|
||||
return SuperVector<16>(_mm_loadu_si128(reinterpret_cast<const m128 *>(ptr)));
|
||||
}
|
||||
|
||||
template <>
|
||||
@@ -516,14 +516,14 @@ really_inline SuperVector<16> SuperVector<16>::load(void const *ptr)
|
||||
{
|
||||
assert(ISALIGNED_N(ptr, alignof(SuperVector::size)));
|
||||
ptr = vectorscan_assume_aligned(ptr, SuperVector::size);
|
||||
return SuperVector<16>(_mm_load_si128((const m128 *)ptr));
|
||||
return SuperVector<16>(_mm_load_si128(reinterpret_cast<const m128 *>(ptr)));
|
||||
}
|
||||
|
||||
template <>
|
||||
really_inline SuperVector<16> SuperVector<16>::loadu_maskz(void const *ptr, uint8_t const len)
|
||||
{
|
||||
SuperVector mask = Ones_vshr(16 -len);
|
||||
SuperVector v = SuperVector<16>(_mm_loadu_si128((const m128 *)ptr));
|
||||
SuperVector v = SuperVector<16>(_mm_loadu_si128(reinterpret_cast<const m128 *>(ptr)));
|
||||
return mask & v;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user