Fix issues reported by gcc -fsanitize flag (#678)
And refine some coding styles, fix JIT compiler data wasm table create issue, add license header for some files.
This commit is contained in:
@ -89,9 +89,9 @@ read_leb(uint8 **p_buf, const uint8 *buf_end,
|
||||
}
|
||||
else if (sign && maxbits == 32) {
|
||||
if (shift < maxbits) {
|
||||
/* Sign extend */
|
||||
result = (((int32)result) << (maxbits - shift))
|
||||
>> (maxbits - shift);
|
||||
/* Sign extend, second highest bit is the sign bit */
|
||||
if ((uint8)byte & 0x40)
|
||||
result |= (~((uint64)0)) << shift;
|
||||
}
|
||||
else {
|
||||
/* The top bits should be a sign-extension of the sign bit */
|
||||
@ -105,9 +105,9 @@ read_leb(uint8 **p_buf, const uint8 *buf_end,
|
||||
}
|
||||
else if (sign && maxbits == 64) {
|
||||
if (shift < maxbits) {
|
||||
/* Sign extend */
|
||||
result = (((int64)result) << (maxbits - shift))
|
||||
>> (maxbits - shift);
|
||||
/* Sign extend, second highest bit is the sign bit */
|
||||
if ((uint8)byte & 0x40)
|
||||
result |= (~((uint64)0)) << shift;
|
||||
}
|
||||
else {
|
||||
/* The top bits should be a sign-extension of the sign bit */
|
||||
|
||||
Reference in New Issue
Block a user