mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
cstylecasts suppress,fixes
This commit is contained in:
parent
e111684bc2
commit
dfa72ffd50
@ -112,6 +112,7 @@ struct hs_database {
|
|||||||
|
|
||||||
static really_inline
|
static really_inline
|
||||||
const void *hs_get_bytecode(const struct hs_database *db) {
|
const void *hs_get_bytecode(const struct hs_database *db) {
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
return ((const char *)db + db->bytecode);
|
return ((const char *)db + db->bytecode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,9 +84,10 @@ struct FDRConfirm {
|
|||||||
|
|
||||||
static really_inline
|
static really_inline
|
||||||
const u32 *getConfirmLitIndex(const struct FDRConfirm *fdrc) {
|
const u32 *getConfirmLitIndex(const struct FDRConfirm *fdrc) {
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
const u8 *base = (const u8 *)fdrc;
|
const u8 *base = (const u8 *)fdrc;
|
||||||
const u32 *litIndex =
|
// cppcheck-suppress cstyleCast
|
||||||
(const u32 *)(base + ROUNDUP_N(sizeof(*fdrc), alignof(u32)));
|
const u32 *litIndex =(const u32 *)(base + ROUNDUP_N(sizeof(*fdrc), alignof(u32)));
|
||||||
assert(ISALIGNED(litIndex));
|
assert(ISALIGNED(litIndex));
|
||||||
return litIndex;
|
return litIndex;
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,7 @@ struct gough_info {
|
|||||||
static really_inline
|
static really_inline
|
||||||
const struct gough_info *get_gough(const struct mcclellan *m) {
|
const struct gough_info *get_gough(const struct mcclellan *m) {
|
||||||
assert(m->haig_offset);
|
assert(m->haig_offset);
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
const char *n = (const char *)m - sizeof(struct NFA);
|
const char *n = (const char *)m - sizeof(struct NFA);
|
||||||
return (const struct gough_info *)(n + m->haig_offset);
|
return (const struct gough_info *)(n + m->haig_offset);
|
||||||
}
|
}
|
||||||
@ -102,6 +103,7 @@ const u32 *get_gough_top_offsets(const struct mcclellan *m) {
|
|||||||
if (!g->top_prog_offset) {
|
if (!g->top_prog_offset) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
const char *n = (const char *)m - sizeof(struct NFA);
|
const char *n = (const char *)m - sizeof(struct NFA);
|
||||||
return (const u32 *)(n + g->top_prog_offset);
|
return (const u32 *)(n + g->top_prog_offset);
|
||||||
}
|
}
|
||||||
|
@ -188,11 +188,13 @@ struct mpv_pq_item {
|
|||||||
static really_inline
|
static really_inline
|
||||||
const struct mpv_puffette *get_puff_array(const struct mpv *m,
|
const struct mpv_puffette *get_puff_array(const struct mpv *m,
|
||||||
const struct mpv_kilopuff *kp) {
|
const struct mpv_kilopuff *kp) {
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
return (const struct mpv_puffette *)((const char *)m + kp->puffette_offset);
|
return (const struct mpv_puffette *)((const char *)m + kp->puffette_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
static really_inline
|
static really_inline
|
||||||
const struct mpv_counter_info *get_counter_info(const struct mpv *m) {
|
const struct mpv_counter_info *get_counter_info(const struct mpv *m) {
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
return (const struct mpv_counter_info *)((const char *)(m + 1)
|
return (const struct mpv_counter_info *)((const char *)(m + 1)
|
||||||
+ m->kilo_count * sizeof(struct mpv_kilopuff));
|
+ m->kilo_count * sizeof(struct mpv_kilopuff));
|
||||||
}
|
}
|
||||||
|
@ -144,6 +144,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void write_bytes(RoseEngine *engine) {
|
void write_bytes(RoseEngine *engine) {
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
copy_bytes((char *)engine + base_offset, blob);
|
copy_bytes((char *)engine + base_offset, blob);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -560,9 +560,10 @@ const struct anchored_matcher_info *getALiteralMatcher(
|
|||||||
if (!t->amatcherOffset) {
|
if (!t->amatcherOffset) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
const char *lt = (const char *)t + t->amatcherOffset;
|
const char *lt = (const char *)t + t->amatcherOffset;
|
||||||
assert(ISALIGNED_CL(lt));
|
assert(ISALIGNED_CL(lt));
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
return (const struct anchored_matcher_info *)lt;
|
return (const struct anchored_matcher_info *)lt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,9 +574,10 @@ const struct HWLM *getFLiteralMatcher(const struct RoseEngine *t) {
|
|||||||
if (!t->fmatcherOffset) {
|
if (!t->fmatcherOffset) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
const char *lt = (const char *)t + t->fmatcherOffset;
|
const char *lt = (const char *)t + t->fmatcherOffset;
|
||||||
assert(ISALIGNED_CL(lt));
|
assert(ISALIGNED_CL(lt));
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
return (const struct HWLM *)lt;
|
return (const struct HWLM *)lt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -584,7 +586,7 @@ const void *getSBLiteralMatcher(const struct RoseEngine *t) {
|
|||||||
if (!t->sbmatcherOffset) {
|
if (!t->sbmatcherOffset) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
const char *matcher = (const char *)t + t->sbmatcherOffset;
|
const char *matcher = (const char *)t + t->sbmatcherOffset;
|
||||||
assert(ISALIGNED_N(matcher, 8));
|
assert(ISALIGNED_N(matcher, 8));
|
||||||
return matcher;
|
return matcher;
|
||||||
@ -592,8 +594,8 @@ const void *getSBLiteralMatcher(const struct RoseEngine *t) {
|
|||||||
|
|
||||||
static really_inline
|
static really_inline
|
||||||
const struct LeftNfaInfo *getLeftTable(const struct RoseEngine *t) {
|
const struct LeftNfaInfo *getLeftTable(const struct RoseEngine *t) {
|
||||||
const struct LeftNfaInfo *r
|
// cppcheck-suppress cstyleCast
|
||||||
= (const struct LeftNfaInfo *)((const char *)t + t->leftOffset);
|
const struct LeftNfaInfo *r = (const struct LeftNfaInfo *)((const char *)t + t->leftOffset);
|
||||||
assert(ISALIGNED_N(r, 4));
|
assert(ISALIGNED_N(r, 4));
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@ -603,16 +605,16 @@ struct mmbit_sparse_iter; // forward decl
|
|||||||
static really_inline
|
static really_inline
|
||||||
const struct mmbit_sparse_iter *getActiveLeftIter(const struct RoseEngine *t) {
|
const struct mmbit_sparse_iter *getActiveLeftIter(const struct RoseEngine *t) {
|
||||||
assert(t->activeLeftIterOffset);
|
assert(t->activeLeftIterOffset);
|
||||||
const struct mmbit_sparse_iter *it = (const struct mmbit_sparse_iter *)
|
// cppcheck-suppress cstyleCast
|
||||||
((const char *)t + t->activeLeftIterOffset);
|
const struct mmbit_sparse_iter *it = (const struct mmbit_sparse_iter *)((const char *)t + t->activeLeftIterOffset);
|
||||||
assert(ISALIGNED_N(it, 4));
|
assert(ISALIGNED_N(it, 4));
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
|
|
||||||
static really_inline
|
static really_inline
|
||||||
const struct NfaInfo *getNfaInfoByQueue(const struct RoseEngine *t, u32 qi) {
|
const struct NfaInfo *getNfaInfoByQueue(const struct RoseEngine *t, u32 qi) {
|
||||||
const struct NfaInfo *infos
|
// cppcheck-suppress cstyleCast
|
||||||
= (const struct NfaInfo *)((const char *)t + t->nfaInfoOffset);
|
const struct NfaInfo *infos= (const struct NfaInfo *)((const char *)t + t->nfaInfoOffset);
|
||||||
assert(ISALIGNED_N(infos, sizeof(u32)));
|
assert(ISALIGNED_N(infos, sizeof(u32)));
|
||||||
|
|
||||||
return &infos[qi];
|
return &infos[qi];
|
||||||
@ -621,6 +623,7 @@ const struct NfaInfo *getNfaInfoByQueue(const struct RoseEngine *t, u32 qi) {
|
|||||||
static really_inline
|
static really_inline
|
||||||
const struct NFA *getNfaByInfo(const struct RoseEngine *t,
|
const struct NFA *getNfaByInfo(const struct RoseEngine *t,
|
||||||
const struct NfaInfo *info) {
|
const struct NfaInfo *info) {
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
return (const struct NFA *)((const char *)t + info->nfaOffset);
|
return (const struct NFA *)((const char *)t + info->nfaOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -650,9 +653,8 @@ const struct SmallWriteEngine *getSmallWrite(const struct RoseEngine *t) {
|
|||||||
if (!t->smallWriteOffset) {
|
if (!t->smallWriteOffset) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
const struct SmallWriteEngine *smwr =
|
const struct SmallWriteEngine *smwr =(const struct SmallWriteEngine *)((const char *)t + t->smallWriteOffset);
|
||||||
(const struct SmallWriteEngine *)((const char *)t + t->smallWriteOffset);
|
|
||||||
return smwr;
|
return smwr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ struct NFA;
|
|||||||
static really_inline
|
static really_inline
|
||||||
const struct NFA *getSmwrNfa(const struct SmallWriteEngine *smwr) {
|
const struct NFA *getSmwrNfa(const struct SmallWriteEngine *smwr) {
|
||||||
assert(smwr);
|
assert(smwr);
|
||||||
const struct NFA *n
|
// cppcheck-suppress cstyleCast
|
||||||
= (const struct NFA *)((const char *)smwr + sizeof(*smwr));
|
const struct NFA *n= (const struct NFA *)((const char *)smwr + sizeof(*smwr));
|
||||||
assert(ISALIGNED_CL(n));
|
assert(ISALIGNED_CL(n));
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
@ -238,6 +238,7 @@ static really_inline u32 diffrich64_256(m256 a, m256 b) {
|
|||||||
// aligned load
|
// aligned load
|
||||||
static really_inline m256 load256(const void *ptr) {
|
static really_inline m256 load256(const void *ptr) {
|
||||||
assert(ISALIGNED_N(ptr, alignof(m256)));
|
assert(ISALIGNED_N(ptr, alignof(m256)));
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
m256 rv = { load128(ptr), load128((const char *)ptr + 16) };
|
m256 rv = { load128(ptr), load128((const char *)ptr + 16) };
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -255,11 +256,13 @@ static really_inline m256 loadu2x128(const void *ptr) {
|
|||||||
static really_inline void store256(void *ptr, m256 a) {
|
static really_inline void store256(void *ptr, m256 a) {
|
||||||
assert(ISALIGNED_N(ptr, alignof(m256)));
|
assert(ISALIGNED_N(ptr, alignof(m256)));
|
||||||
ptr = vectorscan_assume_aligned(ptr, 16);
|
ptr = vectorscan_assume_aligned(ptr, 16);
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
*(m256 *)ptr = a;
|
*(m256 *)ptr = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
// unaligned load
|
// unaligned load
|
||||||
static really_inline m256 loadu256(const void *ptr) {
|
static really_inline m256 loadu256(const void *ptr) {
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
m256 rv = { loadu128(ptr), loadu128((const char *)ptr + 16) };
|
m256 rv = { loadu128(ptr), loadu128((const char *)ptr + 16) };
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -267,6 +270,7 @@ static really_inline m256 loadu256(const void *ptr) {
|
|||||||
// unaligned store
|
// unaligned store
|
||||||
static really_inline void storeu256(void *ptr, m256 a) {
|
static really_inline void storeu256(void *ptr, m256 a) {
|
||||||
storeu128(ptr, a.lo);
|
storeu128(ptr, a.lo);
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
storeu128((char *)ptr + 16, a.hi);
|
storeu128((char *)ptr + 16, a.hi);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -476,8 +480,8 @@ static really_inline u32 diffrich64_384(m384 a, m384 b) {
|
|||||||
// aligned load
|
// aligned load
|
||||||
static really_inline m384 load384(const void *ptr) {
|
static really_inline m384 load384(const void *ptr) {
|
||||||
assert(ISALIGNED_16(ptr));
|
assert(ISALIGNED_16(ptr));
|
||||||
m384 rv = { load128(ptr), load128((const char *)ptr + 16),
|
// cppcheck-suppress cstyleCast
|
||||||
load128((const char *)ptr + 32) };
|
m384 rv = { load128(ptr), load128((const char *)ptr + 16),load128((const char *)ptr + 32) };
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,13 +489,14 @@ static really_inline m384 load384(const void *ptr) {
|
|||||||
static really_inline void store384(void *ptr, m384 a) {
|
static really_inline void store384(void *ptr, m384 a) {
|
||||||
assert(ISALIGNED_16(ptr));
|
assert(ISALIGNED_16(ptr));
|
||||||
ptr = vectorscan_assume_aligned(ptr, 16);
|
ptr = vectorscan_assume_aligned(ptr, 16);
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
*(m384 *)ptr = a;
|
*(m384 *)ptr = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
// unaligned load
|
// unaligned load
|
||||||
static really_inline m384 loadu384(const void *ptr) {
|
static really_inline m384 loadu384(const void *ptr) {
|
||||||
m384 rv = { loadu128(ptr), loadu128((const char *)ptr + 16),
|
// cppcheck-suppress cstyleCast
|
||||||
loadu128((const char *)ptr + 32)};
|
m384 rv = { loadu128(ptr), loadu128((const char *)ptr + 16),loadu128((const char *)ptr + 32)};
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -703,6 +708,7 @@ u32 diffrich64_512(m512 a, m512 b) {
|
|||||||
static really_inline
|
static really_inline
|
||||||
m512 load512(const void *ptr) {
|
m512 load512(const void *ptr) {
|
||||||
assert(ISALIGNED_N(ptr, alignof(m256)));
|
assert(ISALIGNED_N(ptr, alignof(m256)));
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
m512 rv = { load256(ptr), load256((const char *)ptr + 32) };
|
m512 rv = { load256(ptr), load256((const char *)ptr + 32) };
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -711,6 +717,7 @@ m512 load512(const void *ptr) {
|
|||||||
static really_inline
|
static really_inline
|
||||||
void store512(void *ptr, m512 a) {
|
void store512(void *ptr, m512 a) {
|
||||||
assert(ISALIGNED_N(ptr, alignof(m512)));
|
assert(ISALIGNED_N(ptr, alignof(m512)));
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
m512 *x = (m512 *)ptr;
|
m512 *x = (m512 *)ptr;
|
||||||
store256(&x->lo, a.lo);
|
store256(&x->lo, a.lo);
|
||||||
store256(&x->hi, a.hi);
|
store256(&x->hi, a.hi);
|
||||||
@ -719,6 +726,7 @@ void store512(void *ptr, m512 a) {
|
|||||||
// unaligned load
|
// unaligned load
|
||||||
static really_inline
|
static really_inline
|
||||||
m512 loadu512(const void *ptr) {
|
m512 loadu512(const void *ptr) {
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
m512 rv = { loadu256(ptr), loadu256((const char *)ptr + 32) };
|
m512 rv = { loadu256(ptr), loadu256((const char *)ptr + 32) };
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -290,6 +290,7 @@ static really_inline m128 andnot128(m128 a, m128 b) {
|
|||||||
static really_inline m128 load128(const void *ptr) {
|
static really_inline m128 load128(const void *ptr) {
|
||||||
assert(ISALIGNED_N(ptr, alignof(m128)));
|
assert(ISALIGNED_N(ptr, alignof(m128)));
|
||||||
ptr = vectorscan_assume_aligned(ptr, 16);
|
ptr = vectorscan_assume_aligned(ptr, 16);
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
return _mm_load_si128((const m128 *)ptr);
|
return _mm_load_si128((const m128 *)ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,16 +298,19 @@ static really_inline m128 load128(const void *ptr) {
|
|||||||
static really_inline void store128(void *ptr, m128 a) {
|
static really_inline void store128(void *ptr, m128 a) {
|
||||||
assert(ISALIGNED_N(ptr, alignof(m128)));
|
assert(ISALIGNED_N(ptr, alignof(m128)));
|
||||||
ptr = vectorscan_assume_aligned(ptr, 16);
|
ptr = vectorscan_assume_aligned(ptr, 16);
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
*(m128 *)ptr = a;
|
*(m128 *)ptr = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
// unaligned load
|
// unaligned load
|
||||||
static really_inline m128 loadu128(const void *ptr) {
|
static really_inline m128 loadu128(const void *ptr) {
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
return _mm_loadu_si128((const m128 *)ptr);
|
return _mm_loadu_si128((const m128 *)ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// unaligned store
|
// unaligned store
|
||||||
static really_inline void storeu128(void *ptr, m128 a) {
|
static really_inline void storeu128(void *ptr, m128 a) {
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
_mm_storeu_si128 ((m128 *)ptr, a);
|
_mm_storeu_si128 ((m128 *)ptr, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,12 +43,14 @@ void partial_store_u32(void *ptr, u32 value, u32 numBytes) {
|
|||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
unaligned_store_u16(ptr, (u16)value);
|
unaligned_store_u16(ptr, (u16)value);
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
*((u8 *)ptr + 2) = (u8)(value >> 16);
|
*((u8 *)ptr + 2) = (u8)(value >> 16);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
unaligned_store_u16(ptr, (u16)value);
|
unaligned_store_u16(ptr, (u16)value);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
*(u8 *)ptr = (u8)value;
|
*(u8 *)ptr = (u8)value;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
@ -66,12 +68,14 @@ u32 partial_load_u32(const void *ptr, u32 numBytes) {
|
|||||||
return value;
|
return value;
|
||||||
case 3:
|
case 3:
|
||||||
value = unaligned_load_u16(ptr);
|
value = unaligned_load_u16(ptr);
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
value |= ((u32)(*((const u8 *)ptr + 2)) << 16);
|
value |= ((u32)(*((const u8 *)ptr + 2)) << 16);
|
||||||
return value;
|
return value;
|
||||||
case 2:
|
case 2:
|
||||||
value = unaligned_load_u16(ptr);
|
value = unaligned_load_u16(ptr);
|
||||||
return value;
|
return value;
|
||||||
case 1:
|
case 1:
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
value = *(const u8 *)ptr;
|
value = *(const u8 *)ptr;
|
||||||
return value;
|
return value;
|
||||||
case 0:
|
case 0:
|
||||||
@ -90,15 +94,19 @@ void partial_store_u64a(void *ptr, u64a value, u32 numBytes) {
|
|||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
unaligned_store_u32(ptr, (u32)value);
|
unaligned_store_u32(ptr, (u32)value);
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
unaligned_store_u16((u8 *)ptr + 4, (u16)(value >> 32));
|
unaligned_store_u16((u8 *)ptr + 4, (u16)(value >> 32));
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
*((u8 *)ptr + 6) = (u8)(value >> 48);
|
*((u8 *)ptr + 6) = (u8)(value >> 48);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
unaligned_store_u32(ptr, (u32)value);
|
unaligned_store_u32(ptr, (u32)value);
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
unaligned_store_u16((u8 *)ptr + 4, (u16)(value >> 32));
|
unaligned_store_u16((u8 *)ptr + 4, (u16)(value >> 32));
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
unaligned_store_u32(ptr, (u32)value);
|
unaligned_store_u32(ptr, (u32)value);
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
*((u8 *)ptr + 4) = (u8)(value >> 32);
|
*((u8 *)ptr + 4) = (u8)(value >> 32);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
@ -106,12 +114,14 @@ void partial_store_u64a(void *ptr, u64a value, u32 numBytes) {
|
|||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
unaligned_store_u16(ptr, (u16)value);
|
unaligned_store_u16(ptr, (u16)value);
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
*((u8 *)ptr + 2) = (u8)(value >> 16);
|
*((u8 *)ptr + 2) = (u8)(value >> 16);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
unaligned_store_u16(ptr, (u16)value);
|
unaligned_store_u16(ptr, (u16)value);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
*(u8 *)ptr = (u8)value;
|
*(u8 *)ptr = (u8)value;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
@ -129,15 +139,19 @@ u64a partial_load_u64a(const void *ptr, u32 numBytes) {
|
|||||||
return value;
|
return value;
|
||||||
case 7:
|
case 7:
|
||||||
value = unaligned_load_u32(ptr);
|
value = unaligned_load_u32(ptr);
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
value |= (u64a)unaligned_load_u16((const u8 *)ptr + 4) << 32;
|
value |= (u64a)unaligned_load_u16((const u8 *)ptr + 4) << 32;
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
value |= (u64a)(*((const u8 *)ptr + 6)) << 48;
|
value |= (u64a)(*((const u8 *)ptr + 6)) << 48;
|
||||||
return value;
|
return value;
|
||||||
case 6:
|
case 6:
|
||||||
value = unaligned_load_u32(ptr);
|
value = unaligned_load_u32(ptr);
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
value |= (u64a)unaligned_load_u16((const u8 *)ptr + 4) << 32;
|
value |= (u64a)unaligned_load_u16((const u8 *)ptr + 4) << 32;
|
||||||
return value;
|
return value;
|
||||||
case 5:
|
case 5:
|
||||||
value = unaligned_load_u32(ptr);
|
value = unaligned_load_u32(ptr);
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
value |= (u64a)(*((const u8 *)ptr + 4)) << 32;
|
value |= (u64a)(*((const u8 *)ptr + 4)) << 32;
|
||||||
return value;
|
return value;
|
||||||
case 4:
|
case 4:
|
||||||
@ -145,12 +159,14 @@ u64a partial_load_u64a(const void *ptr, u32 numBytes) {
|
|||||||
return value;
|
return value;
|
||||||
case 3:
|
case 3:
|
||||||
value = unaligned_load_u16(ptr);
|
value = unaligned_load_u16(ptr);
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
value |= (u64a)(*((const u8 *)ptr + 2)) << 16;
|
value |= (u64a)(*((const u8 *)ptr + 2)) << 16;
|
||||||
return value;
|
return value;
|
||||||
case 2:
|
case 2:
|
||||||
value = unaligned_load_u16(ptr);
|
value = unaligned_load_u16(ptr);
|
||||||
return value;
|
return value;
|
||||||
case 1:
|
case 1:
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
value = *(const u8 *)ptr;
|
value = *(const u8 *)ptr;
|
||||||
return value;
|
return value;
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
static really_inline
|
static really_inline
|
||||||
u16 unaligned_load_u16(const void *ptr) {
|
u16 unaligned_load_u16(const void *ptr) {
|
||||||
struct unaligned { u16 u; } PACKED__MAY_ALIAS;
|
struct unaligned { u16 u; } PACKED__MAY_ALIAS;
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
const struct unaligned *uptr = (const struct unaligned *)ptr;
|
const struct unaligned *uptr = (const struct unaligned *)ptr;
|
||||||
return uptr->u;
|
return uptr->u;
|
||||||
}
|
}
|
||||||
@ -49,6 +50,7 @@ u16 unaligned_load_u16(const void *ptr) {
|
|||||||
static really_inline
|
static really_inline
|
||||||
u32 unaligned_load_u32(const void *ptr) {
|
u32 unaligned_load_u32(const void *ptr) {
|
||||||
struct unaligned { u32 u; } PACKED__MAY_ALIAS;
|
struct unaligned { u32 u; } PACKED__MAY_ALIAS;
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
const struct unaligned *uptr = (const struct unaligned *)ptr;
|
const struct unaligned *uptr = (const struct unaligned *)ptr;
|
||||||
return uptr->u;
|
return uptr->u;
|
||||||
}
|
}
|
||||||
@ -57,6 +59,7 @@ u32 unaligned_load_u32(const void *ptr) {
|
|||||||
static really_inline
|
static really_inline
|
||||||
u64a unaligned_load_u64a(const void *ptr) {
|
u64a unaligned_load_u64a(const void *ptr) {
|
||||||
struct unaligned { u64a u; } PACKED__MAY_ALIAS;
|
struct unaligned { u64a u; } PACKED__MAY_ALIAS;
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
const struct unaligned *uptr = (const struct unaligned *)ptr;
|
const struct unaligned *uptr = (const struct unaligned *)ptr;
|
||||||
return uptr->u;
|
return uptr->u;
|
||||||
}
|
}
|
||||||
@ -65,6 +68,7 @@ u64a unaligned_load_u64a(const void *ptr) {
|
|||||||
static really_inline
|
static really_inline
|
||||||
void unaligned_store_u16(void *ptr, u16 val) {
|
void unaligned_store_u16(void *ptr, u16 val) {
|
||||||
struct unaligned { u16 u; } PACKED__MAY_ALIAS;
|
struct unaligned { u16 u; } PACKED__MAY_ALIAS;
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
struct unaligned *uptr = (struct unaligned *)ptr;
|
struct unaligned *uptr = (struct unaligned *)ptr;
|
||||||
uptr->u = val;
|
uptr->u = val;
|
||||||
}
|
}
|
||||||
@ -73,6 +77,7 @@ void unaligned_store_u16(void *ptr, u16 val) {
|
|||||||
static really_inline
|
static really_inline
|
||||||
void unaligned_store_u32(void *ptr, u32 val) {
|
void unaligned_store_u32(void *ptr, u32 val) {
|
||||||
struct unaligned { u32 u; } PACKED__MAY_ALIAS;
|
struct unaligned { u32 u; } PACKED__MAY_ALIAS;
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
struct unaligned *uptr = (struct unaligned *)ptr;
|
struct unaligned *uptr = (struct unaligned *)ptr;
|
||||||
uptr->u = val;
|
uptr->u = val;
|
||||||
}
|
}
|
||||||
@ -81,6 +86,7 @@ void unaligned_store_u32(void *ptr, u32 val) {
|
|||||||
static really_inline
|
static really_inline
|
||||||
void unaligned_store_u64a(void *ptr, u64a val) {
|
void unaligned_store_u64a(void *ptr, u64a val) {
|
||||||
struct unaligned { u64a u; } PACKED__MAY_ALIAS;
|
struct unaligned { u64a u; } PACKED__MAY_ALIAS;
|
||||||
|
// cppcheck-suppress cstyleCast
|
||||||
struct unaligned *uptr = (struct unaligned *)ptr;
|
struct unaligned *uptr = (struct unaligned *)ptr;
|
||||||
uptr->u = val;
|
uptr->u = val;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user