mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Enable GCC options to detect undefined behaviour
GCC has an Undefined Behavior Sanitizer (ubsan), which enables run-time checks of undefined behaviour. It has been enabled for the `develop` build target. A small bug detected with it has been fixed. Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This commit is contained in:
@@ -36,14 +36,14 @@ uint8_t oReadLib;
|
||||
*/
|
||||
static int32_t readlong(FILE *f)
|
||||
{
|
||||
int32_t r;
|
||||
uint32_t r;
|
||||
|
||||
r = fgetc(f);
|
||||
r |= fgetc(f) << 8;
|
||||
r |= fgetc(f) << 16;
|
||||
r |= fgetc(f) << 24;
|
||||
r = ((uint32_t)(uint8_t)fgetc(f));
|
||||
r |= ((uint32_t)(uint8_t)fgetc(f)) << 8;
|
||||
r |= ((uint32_t)(uint8_t)fgetc(f)) << 16;
|
||||
r |= ((uint32_t)(uint8_t)fgetc(f)) << 24;
|
||||
|
||||
return r;
|
||||
return (int32_t)r;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user