Use 'ptrdiff_t' instead of 'int' for pointer offset parameters
A number of the load/store functions in mem_neon.h use type 'int' for the 'stride' pointer offset parameter. This causes Clang to generate the following warning every time these functions are called with a wider type passed in for 'stride': warning: implicit conversion loses integer precision: 'ptrdiff_t' (aka 'long') to 'int' [-Wshorten-64-to-32] This patch changes all such instances of 'int' to 'ptrdiff_t'. Bug: b/181236880 Change-Id: I2e86b005219e1fbb54f7cf2465e918b7c077f7ee
This commit is contained in:
committed by
James Zern
parent
35bce9389e
commit
dbda032fcf
@@ -113,7 +113,8 @@ static INLINE void uint32_to_mem(uint8_t *buf, uint32_t a) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load 2 sets of 4 bytes when alignment is not guaranteed.
|
// Load 2 sets of 4 bytes when alignment is not guaranteed.
|
||||||
static INLINE uint8x8_t load_unaligned_u8(const uint8_t *buf, int stride) {
|
static INLINE uint8x8_t load_unaligned_u8(const uint8_t *buf,
|
||||||
|
ptrdiff_t stride) {
|
||||||
uint32_t a;
|
uint32_t a;
|
||||||
uint32x2_t a_u32 = vdup_n_u32(0);
|
uint32x2_t a_u32 = vdup_n_u32(0);
|
||||||
if (stride == 4) return vld1_u8(buf);
|
if (stride == 4) return vld1_u8(buf);
|
||||||
@@ -126,7 +127,7 @@ static INLINE uint8x8_t load_unaligned_u8(const uint8_t *buf, int stride) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Store 2 sets of 4 bytes when alignment is not guaranteed.
|
// Store 2 sets of 4 bytes when alignment is not guaranteed.
|
||||||
static INLINE void store_unaligned_u8(uint8_t *buf, int stride,
|
static INLINE void store_unaligned_u8(uint8_t *buf, ptrdiff_t stride,
|
||||||
const uint8x8_t a) {
|
const uint8x8_t a) {
|
||||||
const uint32x2_t a_u32 = vreinterpret_u32_u8(a);
|
const uint32x2_t a_u32 = vreinterpret_u32_u8(a);
|
||||||
if (stride == 4) {
|
if (stride == 4) {
|
||||||
@@ -139,7 +140,8 @@ static INLINE void store_unaligned_u8(uint8_t *buf, int stride,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load 4 sets of 4 bytes when alignment is not guaranteed.
|
// Load 4 sets of 4 bytes when alignment is not guaranteed.
|
||||||
static INLINE uint8x16_t load_unaligned_u8q(const uint8_t *buf, int stride) {
|
static INLINE uint8x16_t load_unaligned_u8q(const uint8_t *buf,
|
||||||
|
ptrdiff_t stride) {
|
||||||
uint32_t a;
|
uint32_t a;
|
||||||
uint32x4_t a_u32 = vdupq_n_u32(0);
|
uint32x4_t a_u32 = vdupq_n_u32(0);
|
||||||
if (stride == 4) return vld1q_u8(buf);
|
if (stride == 4) return vld1q_u8(buf);
|
||||||
@@ -159,7 +161,7 @@ static INLINE uint8x16_t load_unaligned_u8q(const uint8_t *buf, int stride) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Store 4 sets of 4 bytes when alignment is not guaranteed.
|
// Store 4 sets of 4 bytes when alignment is not guaranteed.
|
||||||
static INLINE void store_unaligned_u8q(uint8_t *buf, int stride,
|
static INLINE void store_unaligned_u8q(uint8_t *buf, ptrdiff_t stride,
|
||||||
const uint8x16_t a) {
|
const uint8x16_t a) {
|
||||||
const uint32x4_t a_u32 = vreinterpretq_u32_u8(a);
|
const uint32x4_t a_u32 = vreinterpretq_u32_u8(a);
|
||||||
if (stride == 4) {
|
if (stride == 4) {
|
||||||
@@ -176,7 +178,7 @@ static INLINE void store_unaligned_u8q(uint8_t *buf, int stride,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load 2 sets of 4 bytes when alignment is guaranteed.
|
// Load 2 sets of 4 bytes when alignment is guaranteed.
|
||||||
static INLINE uint8x8_t load_u8(const uint8_t *buf, int stride) {
|
static INLINE uint8x8_t load_u8(const uint8_t *buf, ptrdiff_t stride) {
|
||||||
uint32x2_t a = vdup_n_u32(0);
|
uint32x2_t a = vdup_n_u32(0);
|
||||||
|
|
||||||
assert(!((intptr_t)buf % sizeof(uint32_t)));
|
assert(!((intptr_t)buf % sizeof(uint32_t)));
|
||||||
@@ -189,7 +191,7 @@ static INLINE uint8x8_t load_u8(const uint8_t *buf, int stride) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Store 2 sets of 4 bytes when alignment is guaranteed.
|
// Store 2 sets of 4 bytes when alignment is guaranteed.
|
||||||
static INLINE void store_u8(uint8_t *buf, int stride, const uint8x8_t a) {
|
static INLINE void store_u8(uint8_t *buf, ptrdiff_t stride, const uint8x8_t a) {
|
||||||
uint32x2_t a_u32 = vreinterpret_u32_u8(a);
|
uint32x2_t a_u32 = vreinterpret_u32_u8(a);
|
||||||
|
|
||||||
assert(!((intptr_t)buf % sizeof(uint32_t)));
|
assert(!((intptr_t)buf % sizeof(uint32_t)));
|
||||||
|
|||||||
Reference in New Issue
Block a user