Skip to content

Commit

Permalink
Suppress build/UBSan warnings + upgrade Hedley
Browse files Browse the repository at this point in the history
  • Loading branch information
animetosho committed Aug 20, 2023
1 parent 626482e commit c9f864a
Show file tree
Hide file tree
Showing 6 changed files with 778 additions and 237 deletions.
4 changes: 2 additions & 2 deletions gf16/gf16_xor_avx512.c
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ void gf16_xor_jit_muladd_multi_avx512(const void *HEDLEY_RESTRICT scratch, unsig
/* cmp/jcc */
write64(jitptr, 0x800FC03948 | (AX <<16) | (CX <<19) | ((uint64_t)JL <<32));
if(info->jitOptStrat == GF16_XOR_JIT_STRAT_COPYNT || info->jitOptStrat == GF16_XOR_JIT_STRAT_COPY) {
write32(jitptr +5, (int32_t)((jitTemp - (jitdst - (uint8_t*)jit->w)) - jitptr -9));
write32(jitptr +5, (int32_t)(((intptr_t)jitTemp - (jitdst - (uint8_t*)jit->w)) - (intptr_t)jitptr -9));
jitptr[9] = 0xC3; /* ret */
/* memcpy to destination */
if(info->jitOptStrat == GF16_XOR_JIT_STRAT_COPYNT) {
Expand Down Expand Up @@ -957,7 +957,7 @@ void gf16_xor_jit_muladd_multi_packed_avx512(const void *HEDLEY_RESTRICT scratch
/* cmp/jcc */
write64(jitptr, 0x800FC03948 | (AX <<16) | (CX <<19) | ((uint64_t)JL <<32));
if(info->jitOptStrat == GF16_XOR_JIT_STRAT_COPYNT || info->jitOptStrat == GF16_XOR_JIT_STRAT_COPY) {
write32(jitptr +5, (int32_t)((jitTemp - (jitdst - (uint8_t*)jit->w)) - jitptr -9));
write32(jitptr +5, (int32_t)(((intptr_t)jitTemp - (jitdst - (uint8_t*)jit->w)) - (intptr_t)jitptr -9));
jitptr[9] = 0xC3; /* ret */
/* memcpy to destination */
if(info->jitOptStrat == GF16_XOR_JIT_STRAT_COPYNT) {
Expand Down
2 changes: 1 addition & 1 deletion gf16/gf16_xor_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ static HEDLEY_ALWAYS_INLINE void gf16_xorjit_write_jit(const void *HEDLEY_RESTRI
jitptr = jitTemp;

jitptr = writeFunc(info, jitptr, coefficient, mode, prefetch);
write32(jitptr, (int32_t)(jitTemp - copyOffset - jitptr -4));
write32(jitptr, (int32_t)((intptr_t)jitTemp - copyOffset - (intptr_t)jitptr -4));
jitptr[4] = 0xC3; /* ret */
jitptr += 5;

Expand Down
1 change: 1 addition & 0 deletions gf16/gf16mul.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1430,6 +1430,7 @@ Galois16Methods Galois16Mul::default_method(size_t regionSizeHint, unsigned inpu
}

std::vector<Galois16Methods> Galois16Mul::availableMethods(bool checkCpuid) {
UNUSED(checkCpuid);
std::vector<Galois16Methods> ret;
ret.push_back(GF16_LOOKUP);
if(gf16_lookup3_stride())
Expand Down
3 changes: 3 additions & 0 deletions hasher/hasher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ const char* md5crc_methodName(MD5CRCMethods m) {


std::vector<HasherInputMethods> hasherInput_availableMethods(bool checkCpuid) {
(void)checkCpuid;
std::vector<HasherInputMethods> ret;
ret.push_back(INHASH_SCALAR);

Expand Down Expand Up @@ -553,6 +554,7 @@ std::vector<HasherInputMethods> hasherInput_availableMethods(bool checkCpuid) {
return ret;
}
std::vector<MD5CRCMethods> hasherMD5CRC_availableMethods(bool checkCpuid) {
(void)checkCpuid;
std::vector<MD5CRCMethods> ret;
ret.push_back(MD5CRCMETH_SCALAR);

Expand All @@ -578,6 +580,7 @@ std::vector<MD5CRCMethods> hasherMD5CRC_availableMethods(bool checkCpuid) {
return ret;
}
std::vector<MD5MultiLevels> hasherMD5Multi_availableMethods(bool checkCpuid) {
(void)checkCpuid;
std::vector<MD5MultiLevels> ret;
ret.push_back(MD5MULT_SCALAR);

Expand Down
4 changes: 2 additions & 2 deletions hasher/md5x2-x86-asm.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ static HEDLEY_ALWAYS_INLINE void md5_process_block_x2_scalar(uint32_t* state, co
ROUND_I(B1, C1, D1, A1, B2, C2, D2, A2, "%[i0_1]", "%[i1_1]", k3, 21) \
: ASM_PARAMS(i2, i3));

A1 += _data[0][0];
A2 += _data[1][0];
A1 += read32(_data[0]);
A2 += read32(_data[1]);

RF4( 1, 2, 3, 4, -0x28955b88, -0x173848aa, 0x242070db, -0x3e423112)
RF4( 5, 6, 7, 8, -0x0a83f051, 0x4787c62a, -0x57cfb9ed, -0x02b96aff)
Expand Down
Loading

0 comments on commit c9f864a

Please sign in to comment.