Fix UndefinedBehaviourSanitizer runtime errors
Fixes the runtime errors in #431. Solves problem 2 in #263 (closed).
- Memory alignment errors in are fixed with
memcpy
. - Workaround negative value bit shift left error by reinterpreting initial
int16
asuint16
and applying left bit shift on resulting positive integer. (I can provide a test script to confirm the behaviour is the same as before)
Edited by Da Yu Tou